axis-labels

Superscript and subscript axis labels in ggplot2 [duplicate]

不羁的心 提交于 2019-11-27 00:11:00
问题 This question already has an answer here: Subscript letters in ggplot axis label 2 answers I need an axis label in ggplot2 which reads "Assimilation (μmol CO2 m-2 s-1)" with the 2 of CO2 as subscript and the -2 and -1 as superscript. Thanks. 回答1: You could try library(ggplot2) qplot(uptake, data = CO2) + xlab(bquote('Assimilation ('*mu~ 'mol' ~CO[2]~ m^-2~s^-1*')')) 来源: https://stackoverflow.com/questions/27445452/superscript-and-subscript-axis-labels-in-ggplot2

Save a ggplot2 time series plot grob generated by ggplotGrob

旧巷老猫 提交于 2019-11-26 22:08:53
问题 This post describes a method to create a two-line x-axis (year below months) on a time series plot. Unfortunately, the method that I use from this post ( option 2 ) is not compatible with ggsave() . library(tidyverse) library(lubridate) df <- tibble( date = as.Date(41000:42000, origin = "1899-12-30"), value = c(rnorm(500, 5), rnorm(501, 10)) ) p <- ggplot(df, aes(date, value)) + geom_line() + geom_vline( xintercept = as.numeric(df$date[yday(df$date) == 1]), color = "grey60" ) + scale_x_date

matplotlib: adding padding/offset to polar plots tick labels

帅比萌擦擦* 提交于 2019-11-26 21:20:19
问题 Is there a way to increase the padding/offset of the polar plot tick labels (theta)? import matplotlib import numpy as np from matplotlib.pyplot import figure, show, grid # make a square figure fig = figure(figsize=(2, 2)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c') ax.set_yticklabels([]) r = np.arange(0, 3.0, 0.01) theta = 2*np.pi*r ax.plot(theta, r, color='#ee8d18', lw=3) ax.set_rmax(2.0) show() I'd like to have theta tick labels further away from the polar plot so

How to force the Y axis to only use integers in Matplotlib?

吃可爱长大的小学妹 提交于 2019-11-26 20:34:08
问题 I'm plotting a histogram using the matplotlib.pyplot module and I am wondering how I can force the y-axis labels to only show integers (e.g. 0, 1, 2, 3 etc.) and not decimals (e.g. 0., 0.5, 1., 1.5, 2. etc.). I'm looking at the guidance notes and suspect the answer lies somewhere around matplotlib.pyplot.ylim but so far I can only find stuff that sets the minimum and maximum y-axis values. def doMakeChart(item, x): if len(x)==1: return filename = "C:\Users\me\maxbyte3\charts\\" bins=logspace

Rotating x axis labels in R for barplot

风格不统一 提交于 2019-11-26 18:33:01
I am trying to get the x axis labels to be rotated 45 degrees on a barplot with no luck. This is the code I have below: barplot(((data1[,1] - average)/average) * 100, srt = 45, adj = 1, xpd = TRUE, names.arg = data1[,2], col = c("#3CA0D0"), main = "Best Lift Time to Vertical Drop Ratios of North American Resorts", ylab = "Normalized Difference", yaxt = 'n', cex.names = 0.65, cex.lab = 0.65) EDITED ANSWER PER DAVID'S RESPONSE: Here's a kind of hackish way. I'm guessing there's an easier way. But you could suppress the bar labels and the plot text of the labels by saving the bar positions from

Axis labels on two lines with nested x variables (year below months)

时光毁灭记忆、已成空白 提交于 2019-11-26 14:21:36
I would like to display months (in abbreviated form) along the horizontal axis, with the corresponding year printed once. I know how to display month-year: The un-needed repetition of the year clutters the labels. Instead I would like something like this: except that the year would be printed below the months. I printed the year above the axis labels, because that's the best I could do. This follows a limitation of the annotate() function, which gets clipped if it lies outside of the plot area. I am aware of possible workarounds based on annotate_custom() , but I couldn't make them to work

Can I show decimal places and scientific notation on the axis of a matplotlib plot using Python 2.7?

删除回忆录丶 提交于 2019-11-26 11:04:24
问题 I am plotting some big numbers with matplotlib in a pyqt program using python 2.7. I have a y-axis that ranges from 1e+18 to 3e+18 (usually). I\'d like to see each tick mark show values in scientific notation and with 2 decimal places. For example 2.35e+18 instead of just 2e+18 because values between 2e+18 and 3e+18 still read just 2e+18 for a few tickmarks. Here is an example of that problem. import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) x =

Rotating x axis labels in R for barplot

让人想犯罪 __ 提交于 2019-11-26 06:27:54
问题 I am trying to get the x axis labels to be rotated 45 degrees on a barplot with no luck. This is the code I have below: barplot(((data1[,1] - average)/average) * 100, srt = 45, adj = 1, xpd = TRUE, names.arg = data1[,2], col = c(\"#3CA0D0\"), main = \"Best Lift Time to Vertical Drop Ratios of North American Resorts\", ylab = \"Normalized Difference\", yaxt = \'n\', cex.names = 0.65, cex.lab = 0.65) 回答1: EDITED ANSWER PER DAVID'S RESPONSE: Here's a kind of hackish way. I'm guessing there's an

Axis labels on two lines with nested x variables (year below months)

心已入冬 提交于 2019-11-26 03:52:41
问题 I would like to display months (in abbreviated form) along the horizontal axis, with the corresponding year printed once. I know how to display month-year: The un-needed repetition of the year clutters the labels. Instead I would like something like this: except that the year would be printed below the months. I printed the year above the axis labels, because that\'s the best I could do. This follows a limitation of the annotate() function, which gets clipped if it lies outside of the plot

How can I put axis on a .png file in java?

假装没事ソ 提交于 2019-11-26 01:34:39
问题 I have chart.png with data in it that I would like to put a simple X - Y axis on with some labeling. I also would like to try not to use any external software that doesn\'t come with java. I\'m allowed to use jfreechart but if there is a way to make it look nice, while just using some plan java code, that would be better. Does anyone have a good idea about how to do this sort of thing? Update: Something like this but the data would be color coded with rgb values and of course there would be