axis-labels

Suppress ticks in plot in r

陌路散爱 提交于 2019-11-27 21:34:50
问题 I want to remove labels and axis from X axis, however adding new ticks. plot(1:10, ylab = "") at1 <- seq(1, 10, 0.1) axis(side = 1, at = at1, labels = FALSE) I could not get rid of y labels. 回答1: see ?par You need the xaxt argument plot(1:10, ylab = "", xaxt='n') 回答2: I am not certain what you want, but this removes the x label and uses the tick marks you are generating with at1: plot(1:10, ylab = "", xlab="") at1 <- seq(1, 10, 0.1) axis(side =1, at1, labels = F) I took the suggestion by GSee

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

可紊 提交于 2019-11-27 20:59:53
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(0.1, 10, 100) plt.hist(x, bins=bins, facecolor='green', alpha=0.75) plt.gca().set_xscale("log") plt

Change the color of the axis labels

Deadly 提交于 2019-11-27 13:47:06
问题 Here's the relevant code: ggplot.3plus<-ggplot(summary.3plus, aes(x=sp1, y=fract.mean, fill=ForestAge)) + geom_bar(position=position_dodge())+ coord_cartesian(ylim = c(1, 1.175))+ geom_errorbar(aes(ymin=fract.mean-se, ymax=fract.mean+se), width=.2, # Width of the error bars position=position_dodge(.9)) ggplot.3plus<- ggplot.3plus + theme(axis.title.x = element_text(colour = "red")) You can see that with the last line of code, I can change the color of the axis title, but not the color of the

d3 axis labeling

做~自己de王妃 提交于 2019-11-27 09:27:18
问题 How do I add text labels to axes in d3? For instance, I have a simple line graph with an x and y axis. On my x-axis, I have ticks from 1 to 10. I want the word "days" to appear underneath it so people know the x axis is counting days. Similarly, on the y-axis, I have the numbers 1-10 as ticks, and I want the words "sandwiches eaten" to appear sideways. Is there a simple way to do this? 回答1: Axis labels aren't built-in to D3's axis component, but you can add labels yourself simply by adding an

Remove plot axis values

若如初见. 提交于 2019-11-27 09:14:46
问题 I was just wondering if there is a way to get rid of axis values, either the x-axis or y-axis respectively, in an r-plot graph. I know that axes = false will get rid of the entire axis, but I would only like to get rid of the numbering. 回答1: Remove numbering on x-axis or y-axis: plot(1:10, xaxt='n') plot(1:10, yaxt='n') If you want to remove the labels as well: plot(1:10, xaxt='n', ann=FALSE) plot(1:10, yaxt='n', ann=FALSE) 回答2: Using base graphics, the standard way to do this is to use axes

pROC ROC curves remove empty space

烈酒焚心 提交于 2019-11-27 07:14:38
问题 I want to draw ROC curves with pRoC. However for some reason there is extra empty space on either side of the x-axis and I cannot remove it with xlim. Some example code: library(pROC) n = c(4, 3, 5) b = c(TRUE, FALSE, TRUE) df = data.frame(n, b) rocobj <- plot.roc(df$b, df$n, percent = TRUE, main="ROC", col="#1c61b6", add=FALSE) I tried the pROC help file, but that doesn't really help me. Even more puzzling is to me that the Y-axis is OK looking... I really appreciate your help! 回答1: Make

Flip facet label and x axis with ggplot2

荒凉一梦 提交于 2019-11-27 06:24:04
问题 I am looking to flip the labels on a faceted panel of 1 row and 5 columns, so that the facet headers appear on bottom, and the x axis appears on top of facets. The reason is that I want to reuse those headers for a table that will be directly below the graph. So in this example... library(ggplot2) my.hist<-ggplot(diamonds, aes(clarity)) + geom_bar() my.hist + facet_wrap( ~ cut, ncol=5) + coord_flip() I would want the "cut" labels to show up below the chart. I was thinking that facet_grid

Overlapping yticklabels: Is it possible to control cell size of heatmap in seaborn?

爱⌒轻易说出口 提交于 2019-11-27 04:47:46
问题 I have a dataset with around 200 observations which I would like to plot as a heatmap. Each observation has a string associated with it which I would like to display. My problem is that I cannot read these labels since they overlap each other. My question is therefore, whether one can somehow set the cell size of the heatmap to the font size of the yticklabel or whether there is any other workaround for that. In my example below, I use random data for illustration purposes: import seaborn as

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

假装没事ソ 提交于 2019-11-27 04:15:29
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 = np.linspace(0, 300, 20) y = np.linspace(0,300, 20) y = y*1e16 ax.plot(x,y) ax.get_xaxis().set_major

Insert blanks into a vector for, e.g., minor tick labels in R

為{幸葍}努か 提交于 2019-11-27 01:40:52
问题 This question relates generally to a previous SO question concerning the creation of minor tick marks on a ggplot2 axis and specifically to a comment in the answer to that question suggesting a function to insert blanks into a sequence may prove useful. As I frequently add minor tick marks to similar plots, I took a stab at creating such a function (see my answer below). 回答1: The following function allows the user to request that every n th element nth of a vector x either be (1) replaced