axis-labels

Adding trend lines across groups and setting tick labels in a grouped violin plot or box plot

我是研究僧i 提交于 2020-07-23 07:37:29
问题 I have xy grouped data that I'm plotting using R 's ggplot2 geom_violin adding regression trend lines: Here are the data: library(dplyr) library(plotly) library(ggplot2) set.seed(1) df <- data.frame(value = c(rnorm(500,8,1),rnorm(600,6,1.5),rnorm(400,4,0.5),rnorm(500,2,2),rnorm(400,4,1),rnorm(600,7,0.5),rnorm(500,3,1),rnorm(500,3,1),rnorm(500,3,1)), age = c(rep("d3",500),rep("d8",600),rep("d24",400),rep("d3",500),rep("d8",400),rep("d24",600),rep("d3",500),rep("d8",500),rep("d24",500)), group

Too many labels on axis

一笑奈何 提交于 2020-07-03 04:32:49
问题 I'm having some trouble with qplot in R. I am trying to plot data from a data frame. When I execute the command below the plot gets bunched up on the left side (see the image below). The data frame only has 963 rows so I don't think size is the issue, but I can use the same command on a smaller data frame and it looks fine. Any ideas? library(ggplot2) qplot(x=variable, y=value, data=data, color=Classification, main="Average MapQ Scores") Or similarly: ggplot(data = data, aes(x = variable, y =

Too many labels on axis

我是研究僧i 提交于 2020-07-03 04:32:08
问题 I'm having some trouble with qplot in R. I am trying to plot data from a data frame. When I execute the command below the plot gets bunched up on the left side (see the image below). The data frame only has 963 rows so I don't think size is the issue, but I can use the same command on a smaller data frame and it looks fine. Any ideas? library(ggplot2) qplot(x=variable, y=value, data=data, color=Classification, main="Average MapQ Scores") Or similarly: ggplot(data = data, aes(x = variable, y =

label coordinate axis with 1-2-5-ticks for given numeric range

半腔热情 提交于 2020-05-15 21:20:53
问题 The somewhat unclear question Exponential Graph Animation P5js Canvas contains an interesting detail about programmatically labeling axes for a broad variety of ranges. I instantly remembered that gnuplot does what I searched for. By interactively zooming in the preview window (and without any particular ticks specification), I observed that it automatically selects a labeling scheme with an amount of between 4 and 10 ticks and a fixed distance of 1, 2, or 5 times some power of 10. The

How to set axis ticks in multiples of pi (Python) (matplotlib)

社会主义新天地 提交于 2020-05-09 18:49:05
问题 I'd like to make a plot in Python and have x range display ticks in multiples of pi. Is there a good way to do this, not manually? I'm thinking of using matplotlib, but other options are fine. EDIT 3: EL_DON's solution worked for me like this: import matplotlib.ticker as tck import matplotlib.pyplot as plt import numpy as np f,ax=plt.subplots(figsize=(20,10)) x=np.linspace(-10*np.pi, 10*np.pi,1000) y=np.sin(x) ax.plot(x/np.pi,y) ax.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))

Supressing Warnings in scale_x_datetime

谁说胖子不能爱 提交于 2020-04-17 04:05:10
问题 This is not a duplicate since none of the methods in that putative duplicate apply here. None of them lead to the warning going away. In fact I got an answer here from Konrad below - use suppressMessages . In the link that is asserted as a possible duplicate, they suggest suppressWarnings , which does not work. After finally figuring out how to get R to use my timezone on the ggplot date axis correctly (found scale_x_datetime in a post here, before it was using my local timezone even though

correct axis range (matlab)

陌路散爱 提交于 2020-03-26 02:43:26
问题 how can i solve the problem of these two images automatically (with a code adaptable to different data) without having to fix the axes range for each plot (i have millions of these plots)? problem: axis range should be smaller problem: axis range should be bigger also, i need axis to be correctly labeled from the first value to last (see example in comment please) any help is highly appreciated. thank you so so much. 回答1: In order to have a complete bounding box use box on . In order to avoid

How to label an axis with several variables in R ggplot2

三世轮回 提交于 2020-03-03 05:48:09
问题 I have a dataframe as follows: Name,Tutor,Test,Score,Percent,school.year Mark,Eric,Maths,100,100,2 Mark,Eric,English,91,91,2 Sue,Richard,Maths,88,100,5 Sue,Richard,English,71,80.7,5 I would like to plot percent on the y axis and name on the x axis with bars for each test. My code does the plot how I would like but the x-axis label is just the name. I would like to add other variables (just to the label) in the x-axis. So for example mark with have 2 bars; 1 for maths and 1 for english, his

Matplotlib - Different tick label alignment along the same axis

六眼飞鱼酱① 提交于 2020-02-22 12:46:18
问题 I have a figure with a lot of subplot, such that the last ticklabel of an axis is written over the first tick label of the next one. See example here As I want to keep the spacing between the subplots as I set it, I would like to have a different alignment depending on the tick, as it could be produced by : plt.xticks([0], ha = 'left') plt.xticks([0.2,0.4], ha = 'center') plt.xticks([0.6], ha = 'right') Using that, only the last call of xticks is shown on the figure. In another way, the idea

Changing axis options for Polar Plots in Matplotlib/Python

无人久伴 提交于 2020-02-02 03:20:31
问题 I have a problem changing my axis labels in Matplotlib. I want to change the radial axis options in my Polar Plot. Basically, I'm computing the distortion of a cylinder, which is nothing but how much the radius deviates from the original (perfectly circular) cylinder. Some of the distortion values are negative, while some are positive due to tensile and compressive forces. I'm looking for a way to represent this in cylindrical coordinates graphically, so I thought that a polar plot was my