I am currently following a tutorial to graph some data using qichart2. When I input the code, it creates a List instead of a graph. The same thing happened to me previously when I was trying to follow a plotly tutorial.
ControlChart <- qic(Force,
data = HudsonData,
chart = 'i',
title = NULL,
xlab = NULL,
x = TimeStamp,
ncol = 1,
show.labels = TRUE,
point.size = 3,
scales = "free_y",
facets = ~ Limb)
This creates a List of 9 instead of a plot like it did in the tutorial.
Is there something I have set up in my R Studio that is creating Lists instead of plots? When I use ggplot2 plots work fine.
Let me know if more info is needed that would be helpful.
Related
I am trying to plot a likert scale of a 1 - 7 scale for every country with the likert package in R, but the R base plot() function won't change any of the text sizes (or even add a main title).
I am generating the plot with:
p <- likert(summary = data )
plot(p,
plot.percents=FALSE,
plot.percent.low=FALSE,
plot.percent.high=FALSE,
include.center=TRUE,
plot.percent.neutral = FALSE,
col = c(brewer.pal(n = 7, name = "RdBu")),
cex.axis = 0.5,
cex.lab=0.5,
main = "title")
Which produces the following plot:
Plot of Countries of the World
All the other plot parameters are working, so I'm not sure why the last 3, the most basic aren't working.
I fixed this by using theme(axis.text) like so:
plot(p,
plot.percents=FALSE,
plot.percent.low=FALSE,
plot.percent.high=FALSE,
include.center=TRUE,
plot.percent.neutral = FALSE,
col = c(brewer.pal(n = 7, name = "RdBu")),
main = "title") +
theme(axis.text=element_text(size=4)
This doesn't answer the larger question as to why the plot() function isn't accepting the parameters, as the title still isn't showing, but it's a band aid solution
I'm trying to make a highcharter item type plot, but I can't make the groups nor the facets like I need. I've been following the existing examples given here and in the highcart's API documentation, but I haven't been able to adapt them to what I need.
The plot data is here. Using said data; this is what I got using ggplot2 + plotly in the meantime. Can you help me replicate this using highcharter?
library(ggplot2)
library(plotly)
ggplotly(ggplot(plot_data, aes(x, y, size = 3, color = Partido, text = name, label = Partido)) +
geom_point() +
facet_wrap(~`¿Cómo votó?`)
)
Output:
Using list() already converts to an items object, like example from this post.
data = list(
list(from = 'Brazil', to = 'Portugal'),
list(from = 'Brazil', to = 'Spain'),
list(from = 'Poland', to = 'England'))
Probably module modules/item-series.js not exist on Highcharter, you can report request for adding on https://github.com/jbkunst/highcharter/issues.
I'm trying to make a plot of some results which are in the form of a list and I want to make an r plot with a custom x-axis, the problem is that xaxt = 'n' is not working for some reason. Maybe someone has an idea or a workaround for this issue. This is how my graph looks, the axis are one on top of the other
Here is the code I am using:
plot(spi_1_gamma, xlim = c(1989,2019), ylim = c(-3,4),
main ='Terlinga, Brewster,Tx, SPI_Gamma-1', xaxt = "n")
axis(side = 1, at = 1989:2019, tick = 1,las = 2)
For the data that I am using, I am not sure how to share it because it is a spei object from the spei package so I will tr this
data <- head(spi_1_gamma)
dput(data)
Let's say I've assigned a plot in R to a variable name. Here's an example I'm currently working on, although any variable <- plotting code example will do:
myplot <- wireframe(sag.pr.dev ~ Col*Row, data=t22mapee,
xlab = "col",
ylab = "row",
ylim = c(33,1),
main = "T22 PR Sag Deviation",
#zlim=c(-0.6, 0.2),
drape = TRUE,
colorkey = TRUE,
scales = list(arrows=FALSE,cex=.5, tick.number = 10, z = list(arrows=F), distance =c(1.5, 1.5, 1.5)),
col.regions = terrain.colors(100),
screen = list(z = 30, x = -60))
Typing myplot will draw the plot on demand. But my question is: Is there a command/method to retrieve the code stored under myplot later? I'm aware of things like ls(myplot) and the like, but that only gives a list of commands invoked and not the actual code.
I need to do this because I have some plot code that has rolled off my screen in the current R session (due to foolishly listing out a few very long data frames), and I don't exactly remember how I created a few particular plots.
Thanks!
YES! You should be able to get back the code using
myplot$call
You can see this by typing str(myplot) and browsing the output.
I'm using the function waterfall from GenVisR package. As the vignette suggests, I am changing the top plot with custom values. However, those values cannot be specified and appear in gray as "Undefined" (see image)
.
I would like to add a layer with ggplot in order to define (and colour) the barplot like the following plot:
In the vignette the authors have an argument called mutBurdenLayer that seems to do the job but I'm not able to change the graph.
Any ideas?
Here is my code:
library(GenVisR)
library(ggplot2)
library(RColorBrewer)
custom_pallete <- brewer.pal(8, "Paired")
waterfall(VCFs, coverageSpace = 179977, main_geneLabSize = 5,
mainLabelSize = 2, mainLabelCol="HGVSp", mainDropMut = T,
mainPalette = custom_pallete, mainXlabel = T)
I would like to add something like:
mut_burden_layer <- theme(...)
waterfall(VCFs, coverageSpace = 179977, main_geneLabSize = 5,
mainLabelSize = 2, mainLabelCol="HGVSp", mainDropMut = T,
mainPalette = custom_pallete, mutBurden = mut, mainXlabel = T,
mutBurdenLayer = mut_burden_layer)
Being mutBurden a data table with the new proportions and mutBurdenLayer the parameter I would like to custom.