axis-labels

Gnuplot Bar chart with error bars

旧城冷巷雨未停 提交于 2021-02-10 05:27:06
问题 I have the following data Name Value of the bar Confidence interval A 0.62 [0.59 0.63] B 0.64 [0.54 0.72] C 0.51 [0.46 0.67] D 0.33 [0.25 0.36] I tried to plot it as a bar chart with A,B,C and D labeling each bar and with and error bar. By using plot "my.dat" using 1; with boxes I only get a bar chart. Can someone help me? 回答1: If you also want errorbars, you must add a second plot with the yerrorbars plotting style. The brackets aren't very handy in the data file, so I remove them with a sed

R ggplot: How can I create conditional labeling for a continuous axis ticks

*爱你&永不变心* 提交于 2021-02-09 08:31:55
问题 I would like to conditionally alter the color/face/etc of a continuous tick mark label using logic instead of hard coding. For example: library(tidyverse) library(viridis) xx=rpois(1000,lambda = 40) y=density(xx,n=3600,from=0) ggplot(data.frame(x = y$x, y = y$y), aes(x, y)) + geom_line() + geom_segment(aes(xend = x, yend = 0, colour = y)) + scale_color_viridis() + labs(y='Density',x='Count',colour='Density')+ geom_vline(xintercept=40,color='red') + scale_x_continuous(breaks=c(0,40,seq(25,100

R ggplot: How can I create conditional labeling for a continuous axis ticks

邮差的信 提交于 2021-02-09 08:30:29
问题 I would like to conditionally alter the color/face/etc of a continuous tick mark label using logic instead of hard coding. For example: library(tidyverse) library(viridis) xx=rpois(1000,lambda = 40) y=density(xx,n=3600,from=0) ggplot(data.frame(x = y$x, y = y$y), aes(x, y)) + geom_line() + geom_segment(aes(xend = x, yend = 0, colour = y)) + scale_color_viridis() + labs(y='Density',x='Count',colour='Density')+ geom_vline(xintercept=40,color='red') + scale_x_continuous(breaks=c(0,40,seq(25,100

R ggplot: How can I create conditional labeling for a continuous axis ticks

こ雲淡風輕ζ 提交于 2021-02-09 08:30:27
问题 I would like to conditionally alter the color/face/etc of a continuous tick mark label using logic instead of hard coding. For example: library(tidyverse) library(viridis) xx=rpois(1000,lambda = 40) y=density(xx,n=3600,from=0) ggplot(data.frame(x = y$x, y = y$y), aes(x, y)) + geom_line() + geom_segment(aes(xend = x, yend = 0, colour = y)) + scale_color_viridis() + labs(y='Density',x='Count',colour='Density')+ geom_vline(xintercept=40,color='red') + scale_x_continuous(breaks=c(0,40,seq(25,100

R ggplot: How can I create conditional labeling for a continuous axis ticks

久未见 提交于 2021-02-09 08:30:16
问题 I would like to conditionally alter the color/face/etc of a continuous tick mark label using logic instead of hard coding. For example: library(tidyverse) library(viridis) xx=rpois(1000,lambda = 40) y=density(xx,n=3600,from=0) ggplot(data.frame(x = y$x, y = y$y), aes(x, y)) + geom_line() + geom_segment(aes(xend = x, yend = 0, colour = y)) + scale_color_viridis() + labs(y='Density',x='Count',colour='Density')+ geom_vline(xintercept=40,color='red') + scale_x_continuous(breaks=c(0,40,seq(25,100

seasonal ggplot in R?

强颜欢笑 提交于 2021-02-08 08:17:00
问题 I am looking at data from Nov to April and would like to have a plot starting from Nov to April. Below is my sample code to screen out month of interests. library(tidyverse) mydata = data.frame(seq(as.Date("2010-01-01"), to=as.Date("2011-12-31"),by="days"), A = runif(730,10,50)) colnames(mydata) = c("Date", "A") DF = mydata %>% mutate(Year = year(Date), Month = month(Date), Day = day(Date)) %>% filter(Month == 11 | Month == 12 | Month == 01 | Month == 02 | Month == 03 | Month == 04) I tried

Sequence x-Axis labels when when 'breaks' has already been defined (R, ggplot)

大憨熊 提交于 2021-02-05 09:28:37
问题 I used scale() function on my data to avoid high correlation when doing a mixed model. Now I want the original values to appear in my plot. So I reversed the scaling with x * attr(x, 'scaled:scale') + attr(x, 'scaled:center') and put the values in a new column of the dataframe that I use to plot. So as an example my data now looks something like this, where x is the real value and x.s the scaled value: x <- sample(x=1:100, size = 50) y <- sample(x=1:100, size = 50) df <- as.data.frame(cbind(x

Sequence x-Axis labels when when 'breaks' has already been defined (R, ggplot)

你说的曾经没有我的故事 提交于 2021-02-05 09:27:25
问题 I used scale() function on my data to avoid high correlation when doing a mixed model. Now I want the original values to appear in my plot. So I reversed the scaling with x * attr(x, 'scaled:scale') + attr(x, 'scaled:center') and put the values in a new column of the dataframe that I use to plot. So as an example my data now looks something like this, where x is the real value and x.s the scaled value: x <- sample(x=1:100, size = 50) y <- sample(x=1:100, size = 50) df <- as.data.frame(cbind(x

Detect when matplotlib tick labels overlap

冷暖自知 提交于 2021-02-05 07:09:22
问题 I have a matplotlib bar chart generated by pandas, like this: index = ["Label 1", "Label 2", "Lorem ipsum dolor sit amet", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ac vehicula leo, vitae sodales orci."] df = pd.DataFrame([1, 2, 3, 4], columns=["Value"], index=index) df.plot(kind="bar", rot=0) As you can see, with 0 rotation, the xtick labels overlap. How can I detect when two labels overlap, and rotate just those two labels to 90 degrees? 回答1: There is no easy way to

Detect when matplotlib tick labels overlap

。_饼干妹妹 提交于 2021-02-05 07:08:30
问题 I have a matplotlib bar chart generated by pandas, like this: index = ["Label 1", "Label 2", "Lorem ipsum dolor sit amet", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ac vehicula leo, vitae sodales orci."] df = pd.DataFrame([1, 2, 3, 4], columns=["Value"], index=index) df.plot(kind="bar", rot=0) As you can see, with 0 rotation, the xtick labels overlap. How can I detect when two labels overlap, and rotate just those two labels to 90 degrees? 回答1: There is no easy way to