axis-labels

How to have a common label for all x and y axes in case of subplots?

假装没事ソ 提交于 2019-12-31 04:11:22
问题 I have used the following loop to get subplots: for j=1:19; Aj=B(j,:); subplot(5,4,j); plot(Aj,h) end For all these subplots, I need to have only one x-label and one y-label. How to do this? Also how to insert legend to all the subplots? 回答1: You can use suplabel from the FileExchange to have combined x and y label for all subplots. Example: subplot(1,2,1); plot(randperm(40)); hold on; plot(randperm(40)); %Plotting some random data legend('show') %To show the legend subplot(1,2,2); plot

Set different positions of axis labels and tick marks in a barplot

一个人想着一个人 提交于 2019-12-30 09:45:31
问题 I would like to realign/offset the x-axis and associated tick marks of a barplot. This should be simple but I am having trouble finding an answer. Below is some example data with 24 categories. xval = c(1:24) count = c(0.03,0.03,0.08,0.06,0.11,0.4,0.3,0.5,0.5,0.6,0.4,0.1,0.1,0.4,0.2,0.1,0.06,0.05,0.03,0.02,0.01,0.03,0.01,0.02) df = as.data.frame(cbind(xval, count)) I can easily produce a barplot with tick marks aligned at the bar midpoints using the below code: mp <- barplot(df$count, space=0

Changing the radius of a coord_polar ggplot

六眼飞鱼酱① 提交于 2019-12-29 07:47:10
问题 I'm looking to reduce the display radius of a pie chart built in ggplot2 relative to the rest of the plot (as the defaults keep cutting off my category labels). Here's some dummy data and code that should show you what I'm experiencing: library(ggplot2) library(scales) library(grid) Region <- c("North America", "Central America", "South America", "Carribbean", "Western Africa", "Northern Africa", "Southern Afica", "Eastern Africa") Conti <- c(rep("Americas",4), rep("Africa",4)) Freq <- c

Changing format of some axis labels in ggplot2 according to condition

。_饼干妹妹 提交于 2019-12-28 15:22:43
问题 I have a ggplot and I want to highlight only some specific x-axis labels according to a predefined condition. I know that axis text is controlled by theme(axis.text = element_text(...)) but this applies to all labels of the axis. What I want is that the formatting change be applied only the labels that have condition = 1. 回答1: You can include for example ifelse() function inside element_text() to have different labels. ggplot(iris,aes(Species,Petal.Length))+geom_boxplot()+ theme(axis.text.x=

How do I make my axis ticks face Inwards in ggplot2

≡放荡痞女 提交于 2019-12-28 13:44:08
问题 I have made a barplot using ggplot2 and the Journal I need to submit to requires that the axis ticks face inwards. This is the text representation of my data (dput) Mean.Inc.melt<-structure(list(Var1 = structure(c(1L, 2L, 1L, 2L, 1L, 2L), .Label = c("Harvest","Pre-Harvest"), class = "factor"), Var2 = structure(c(1L, 1L, 2L, 2L, 3L, 3L), .Label =c("Dip A", "Trip A", "Trip B"), class = "factor"), value = c(2, 34, 1, 36, 3, 46)), .Names =c("Var1", "Var2", "value"), row.names = c(NA, -6L), class

nonlinear scaling image in figure axis matplotlib

与世无争的帅哥 提交于 2019-12-25 09:13:05
问题 enter image description hereI hope I have not over-looked as previously asked question. I don't think so. I have an image of a spectrum. I have several laser lines for calibration. Since the laser lines and the spectrum were collected in the same way they should be correlated in pixel distance. The relationship between pixel number and wavelength is nonlinear. I have fit the pixel number along the x-axis against the wavelength of the laser lines (blue @ 405nm green @ 532nm and red @ 650nm)

How to change the x-axis labels from a character to a different one?

时光总嘲笑我的痴心妄想 提交于 2019-12-25 04:21:23
问题 I've got a questions regarding the xaxis labels. In contrast to whats discussed in here: How to specify the actual x axis values to plot as x axis ticks in R I plotted a dataframe containing 10 columns. Each one is represented in a boxplot. For the x-axis my labels are Pipe1 till Pipe 10. Now I wanna change those labels to a specific ID for instance this way windows() par(mfrow= c(2,1),las=3) boxplot(output.valid.fast,outline=F, xlab ="Pipes",ylab="RMSE(-)") axis(1,at=c("Pipe1","Pipe2","Pipe3

d3.js scale doesn't place tick at the top

筅森魡賤 提交于 2019-12-24 14:05:14
问题 I am currently working on a stacked bar chart, and I'm having a problem with the axis labels. The labels look fine at first blush, but I noticed that there is not always a tick at the top of the Y axis. I've pasted a picture below. As you can see, there are no ticks above 120,000 even though there is a bar that clearly goes beyond that value. I realize that the axis is creating ticks at regular intervals, but is there a way to force the last tick value to be the max value of the scale? If not

Chart - Controlling axis interval, spacing and visibility

偶尔善良 提交于 2019-12-24 11:46:18
问题 Using chart windows forms control to display: STACKED COLUMN Several series, ~70 datapoints per series. Let's say x: 0 - 70. Secondary Y-axis. POINT/LINE 0-3 series displayed, ~20 datapoints per series. X-values are 0-20, so only covering part of the chartarea. Primary Y-axis. I am adding custom labels to the x-axis. The user can choose to show 24, 48 or 72 datapoints. Depending on the number of datapoints, the interval on the x-axis is changed. 24 -> Interval 1 48 -> Interval 2 72 ->

matplotlib correlation matrix heatmap with grouped colors as labels

瘦欲@ 提交于 2019-12-24 10:43:54
问题 I have a correlation matrix hat I am trying to visualize with matplotlib. I can create a heatmap style figure just fine, but I am running into problems with how I want the labels. I'm not even sure if this is possible, but this is what I'm trying to do and can't seem to make it work: My correlation matrix is 150 X 150. On either the x or y (or both...this doesn't matter) axis, I would like to group the labels and then simply label them with a color, or a white label on a color background. To