How to position lines in the y-axis closer to each other as well as to the x-axis

Advertisements This question concerns the same data and graph as in my previous question: How to position lines in the y-axis closer to each other, but the question itself is a bit different. The data is: df <- structure(list(vec = c("PC", "DEFAULT", "INFORMED"), mean = c(1.34944359241928, 1.36249329506777, 1.34671188869646), sd = c(0.57779881866326, 0.537279303541924, 1.53585580464849), min =… Read More How to position lines in the y-axis closer to each other as well as to the x-axis

Adding white space around plot in Matplotlib

Advertisements I have a figure with a fixed size and want to change the size of the plot inside it, i.e., add white space around it. Most questions online deal with removing white space or subplots, which I don’t have. My plotting code is fig = plt.figure(figsize=(14,10)) plt.plot(n, y) plt.savefig(‘figure.png’, bbox_inches=’tight’, dpi=200) so really nothing… Read More Adding white space around plot in Matplotlib

histogram with different label

Advertisements I am plotting the data with histogram, however I see odd color which I did not assign. Is there hindden data behind? def plot_train_test_hist(train_df, val_df,test_df,bins=1000, colname=’exp_mean’): ”’ Check distribution of train/test scores, sanity check that its not skewed”’ plt.hist(train_df[colname].values,bins=bins,label=’train’,alpha=0.7) plt.hist(val_df[colname].values,bins=bins,label=’val’,alpha=0.5) plt.hist(test_df[colname].values,bins=bins,label=’test’,alpha=0.4) plt.legend() plt.xlabel(colname,fontsize=14) plt.ylabel("Count",fontsize=14) plt.suptitle("Histogram of dataset") plt.title(‘w/o masking in Log’,size= ‘small’) plt.show() >Solution… Read More histogram with different label

ggplot2 plotmath: using bquote to add (<=) sign in label error

Advertisements I’m trying to add a less than or equal sign "<=" label in my ggplot but keep getting the error: Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : invalid mathematical annotation Any suggestions on how I can fix this? lower_limit <- 15 ggplot(mtcars, aes(wt, mpg)) + geom_point() + scale_y_continuous(limits = c(lower_limit, 35), breaks = c(lower_limit,… Read More ggplot2 plotmath: using bquote to add (<=) sign in label error

being told x and y are different sizes when plotting

Advertisements i have the following code: distrobution.plot(x = ["Observed", "Modelled"], y = ["Amount (mm)"], kind = "scatter", ylabel="Rainfall (mm)", figsize=(8,4), title ="Daily Rainfall Distrobution") for the following dataframe: but am getting the error: ‘x and y must be the same size’ How are they not the same size? >Solution : You have to plot each… Read More being told x and y are different sizes when plotting

plotting multiple lines in the same plot using ggplot in R

Advertisements I need to draw multiple line graphs that has some grouping. My data is follows: roc_mj_cmb_t1= c(0.8115,0.8060,0.8114,0.8340,0.8789,0.8743,0.8807,0.8838, 0.7946,0.7904,0.8245,0.8198,0.8721,0.8686,0.8876,0.8763, 0.8204,0.8146,0.7982,0.8350, 0.7977,0.8021,0.8137,0.8176 ) roc_mj_lab= c(rep("Y1_uni_cmb_test1",4),rep("Y1_Joint_test1",4), rep("Y1_uni_cmb_test2",4),rep("Y1_Joint_test2",4), rep("Y1_uni_both_test1",4), rep("Y1_uni_both_test2",4)) settin=c("setting 1","setting 2","setting 3","setting 4","setting 1","setting 2","setting 3","setting 4" ,"setting 1","setting 2","setting 3","setting 4","setting 1","setting 2","setting 3","setting 4" ,"setting 1","setting 2","setting 3","setting 4","setting 1","setting 2","setting 3","setting 4") data_mj=data.frame(settin,roc_mj_cmb_t1,roc_mj_lab)… Read More plotting multiple lines in the same plot using ggplot in R

String Literals and Plotting with Matplotlib

Advertisements I’d like to plot an amplitude spectral density for a device with matplotlib. Typical units for these kinds of plots are sensor_units/Hz^(1/2). Because I have a few different kinds of sensors, I’d like to pass the correct sensor_units as each time I plot, so I’ve written the axis label as r’Coupling {}$/\sqrt{\mathrm{Hz}}$’.format(units) this gives… Read More String Literals and Plotting with Matplotlib