Comments (4)
Hi,
Thank you for the suggestion.
I have tried measles <- measles[nrow(measles):1,]
and it works.
library(iheatmapr)
data(measles, package = "iheatmapr")
measles <- measles[nrow(measles):1,]
main_heatmap(measles, name = "Measles<br>Cases", x_categorical = FALSE,
layout = list(font = list(size = 8))) %>%
add_col_groups(ifelse(1930:2001 < 1961,"No","Yes"),
side = "bottom", name = "Vaccine<br>Introduced?",
title = "Vaccine?",
colors = c("lightgray","blue")) %>%
add_col_labels(ticktext = seq(1930,2000,10),font = list(size = 8)) %>%
add_row_labels(size = 0.3,font = list(size = 6)) %>%
add_col_summary(layout = list(title = "Average<br>across<br>states"),
yname = "summary") %>%
add_col_title("Measles Cases from 1930 to 2001", side= "top") %>%
add_row_summary(groups = TRUE,
type = "bar",
layout = list(title = "Average<br>per<br>year",
font = list(size = 8)))
Created on 2022-02-10 by the reprex package (v2.0.1)
from iheatmapr.
I can't give you the excact solution without knowing the code you used to generate this, but I guess a single call of forcats::fct_rev
before passing the data to the heatmap function would give you the desired results.
from iheatmapr.
Hi,
The code to generate is from the Readme.md file in https://github.com/ropensci/iheatmapr
library(iheatmapr)
data(measles, package = "iheatmapr")
main_heatmap(measles, name = "Measles<br>Cases", x_categorical = FALSE,
layout = list(font = list(size = 8))) %>%
add_col_groups(ifelse(1930:2001 < 1961,"No","Yes"),
side = "bottom", name = "Vaccine<br>Introduced?",
title = "Vaccine?",
colors = c("lightgray","blue")) %>%
add_col_labels(ticktext = seq(1930,2000,10),font = list(size = 8)) %>%
add_row_labels(size = 0.3,font = list(size = 6)) %>%
add_col_summary(layout = list(title = "Average<br>across<br>states"),
yname = "summary") %>%
add_col_title("Measles Cases from 1930 to 2001", side= "top") %>%
add_row_summary(groups = TRUE,
type = "bar",
layout = list(title = "Average<br>per<br>year",
font = list(size = 8)))
Unfortunately, I do not know how to use forcats::fct_rev
to get what is required due to my limited understanding of this function.
Could you help me in this ?
from iheatmapr.
Looking at this I assume simply reversing the row order in the input matrix should do.
Try adding
measles <- measles[nrow(measles):1, ]
in between your data(...)
and main_heatmap(...)
lines.
from iheatmapr.
Related Issues (20)
- textangle messes-up the row or column labels HOT 1
- layout of colorbars of annotations
- Reverse dependency checks fail with `ggdendro` HOT 5
- Adding empty annotation causes an error HOT 2
- Single row heatmap does not show HOT 2
- Column annotation label disappeared HOT 10
- Scale the main_heatmap
- Add extra markings to specific cells
- Bug: error causes heatmap to disappear if it tries to re-plot after a plotly plot is rendered HOT 1
- iheatmapr in shiny is not responsive HOT 1
- renderIheatmap breaks when used with shiny::req HOT 3
- Using multiple colors for axis ticks HOT 2
- Add animation/slider function
- Decorate heatmap body
- [FEATURE REQUEST] Use with Chart studio HOT 1
- Buffer and size dendrogram argument to add_*_clustering
- iheatmapr doesn't work when on the same HTML page as a standard plotly widget HOT 1
- Resize width and height of html file using saveWidget or save_iheatmap
- CRAN deprecation HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iheatmapr.