axis-labels

(R) Axis widths in gbm.plot

▼魔方 西西 提交于 2020-01-06 21:40:11
问题 Hoping for some pointers or some experiences insight as i'm literally losing my mind over this, been trying for 2 full days to set up the right values to have a function spit out clean simple line plots from the gbm.plot function (packages dismo & gbm). Here's where I start. bty=n in par to turn off the box & leave me with only left & bottom axes. Gbm.plot typically spits out one plot per explanatory variable, so usually 6 plots etc, but I'm tweaking it to do one per variable & looping it. I

(R) Axis widths in gbm.plot

时光毁灭记忆、已成空白 提交于 2020-01-06 21:36:55
问题 Hoping for some pointers or some experiences insight as i'm literally losing my mind over this, been trying for 2 full days to set up the right values to have a function spit out clean simple line plots from the gbm.plot function (packages dismo & gbm). Here's where I start. bty=n in par to turn off the box & leave me with only left & bottom axes. Gbm.plot typically spits out one plot per explanatory variable, so usually 6 plots etc, but I'm tweaking it to do one per variable & looping it. I

Python - Remove axis tick labels, keeping ticks and axis label

南笙酒味 提交于 2020-01-05 12:34:07
问题 I would like to remove the numerical values in each thick of my y-axis (10, 20, 30, etc.) but keeping the thick marks and the axis label. So far I just have: yticks([]) but it removes the ticks as well. I also tried: frame=gca() frame.axes.get_yaxis().set_visible(False) but it removes both axis label and axis ticks. 回答1: You can set the tick labels to an empty list: from matplotlib.pyplot import * gca().set_xticklabels(['']*10) plot(range(10)) Results in I had to do that before I called plot

Trim first and last labels in ggplot2

拟墨画扇 提交于 2020-01-04 06:31:20
问题 I've got a plot that is tabulating two types of data by day and I'm looking to just trim the first and last label from the plot. Here is a reproducible example of the data: library(dplyr) library(ggplot2) library(scales) dates <- paste0("2014-01-", 1:31) dat <- data.frame("Date" = sample(dates, 4918, replace=T), "Type" = sample(c('Type1', 'Type2'), 4918, replace=T, probs=c(.55, .45))) p.data <- dat %>% group_by(Date, Type) %>% summarise(Freq = n()) p.data$Date <- as.Date(p.data$Date) Here is

AndroidPlot: domain labels from 1 to 11

戏子无情 提交于 2020-01-04 05:25:10
问题 I've implemented AndroidPlot in my app and it works fine, apart from the X-axis labels, which they go from 0 to ten. I'd like to display 1 to eleven. Besides, the labels on the Y-axis do not appear. Code I'm using: import java.text.DecimalFormat; import java.util.Arrays; import android.app.Activity; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import com

how to label axis with all the row names from dataframe

China☆狼群 提交于 2020-01-04 04:26:12
问题 I have the dataframe that contains about 430 rows: name Right_Answers Wrong_Answers Alice Ji 7 6 Eleonora LI 2 5 Mike The 6 5 Helen Wo 5 3 for visualize the number of right (red) and wrong (blue) answers I'm using the matplotlib library with following functions: g=df.plot(x='name', color=['b','r'], figsize=(100,50)) ax.xaxis.set_major_locator(MultipleLocator(0.1)) labels = df.name.values[:] ax = plt.gca() ax.set_xticklabels(labels, rotation=90) but I have always only 8 names as labels on X

Bokeh Plot with a nominal or ordinal axis type

痴心易碎 提交于 2020-01-02 11:06:11
问题 Edit: The code in the original question refers to a version of Bokeh that is years out of date. But the answer below has been updated to answer the same question for modern versions of Bokeh Bokeh Plot with a nominal axis type from bokeh.plotting import * from bokeh.objects import * output_notebook() label = ['United States', 'Russia', 'South Africa', 'Europe (average)', 'Canada', 'Austalia', 'Japan'] number = [1, 2, 3, 4, 5, 6, 7] value = [700, 530, 400, 150, 125, 125, 75] yr = Range1d(start

In R base plot, move axis label closer to axis

余生颓废 提交于 2020-01-01 01:11:07
问题 I have eliminated labels on the y axis because only the relative amount is really important. w <- c(34170,24911,20323,14290,9605,7803,7113,6031,5140,4469) plot(1:length(w), w, type="b", xlab="Number of clusters", ylab="Within-cluster variance", main="K=5 eliminates most of the within-cluster variance", cex.main=1.5, cex.lab=1.2, font.main=20, yaxt='n',lab=c(length(w),5,7), # no ticks on y axis, all ticks on x family="Calibri Light") However, suppressing those tick labels leaves a lot of white

Display power of 10 at axis' end

左心房为你撑大大i 提交于 2019-12-31 06:54:10
问题 My data runs from 0 to 800000 on the x-axis and I have 4 plots in a square. To make the scale readable, I'd like to label the ticks from 0 to 8 (i.e. with %1.0t ) and write the *10^5 at the end of the scale. I tried several format options, but all of them add *10^5 or e5 behind each tick. Is there a way to only put it in the end instead of each one? 回答1: set xtics 100000 format "%1.0t" set label "*10^5" at graph 1, 0 offset 4 However the more conventional approach is to explain the scale in

change ticks number on a subplot

微笑、不失礼 提交于 2019-12-31 04:17:08
问题 If I have a subplot how can I change its NUMBER of ticks? I don't know the maximum and the minimum of the data. my code is: azal = rif.add_subplot(111) azal.plot(eels*(10**9), averspe, label='data') azal.plot(eels*(10**9), beck, label='fit') azal.set_yscale('log') azal.set_xscale('log') h2 = azal.axvline(x = p2*(10**9), color='r') azal.legend(bbox_to_anchor=(1.05, 1), loc=4, fontsize='xx-large', borderaxespad=0.) rif.canvas.draw() 回答1: You can use the matplotlib.ticker.MaxNLocator to