Interesting question. Assuming of course that your plotting function is using pretty() (or something that behaves like it) to determine axis breaks, this should provide a general-enough solution: f <- function(x, range) { rcol <- floor(log10(abs(diff(pretty(range)[1:2])))) round(x, -rcol) } ## Test it out options(digits=15) x <- c(3.20003, 3.20006) f(pi, x)...

I'd suggest that you remove the transition on the dy and transform attribute. This updated fiddle may help you with that: http://jsfiddle.net/esy6wk8n/4/ The changes are all in your update function. var no_trans = svg; svg = svg.transition().duration(750); lp.transition() .duration(750) .attr("transform", "translate(" + this.x(data[0].jdate) + ")"); lu.transition() .duration(750) .attr("transform", "translate(" +...

As per my comment your code (or my variant below) could in principle work but does not because there are more than 128 discrete categories... ggplot(m_tweet)+geom_histogram(aes(x=as.factor(itemId)))+ scale_x_discrete(breaks=labels_mtweet, labels=as.character(labels_mtweet))+ labs(x="Movie Id", y = "Number of ratings per movie", title = "Distribution of ratings per movie - MovieTweetings") Given the limitation on...

based on feedback from http://stackoverflow.com/users/1855677/bondeddust, the code should be emended to read (see double asterisks): results = read.table("./ceu_asn_afr.txt",head=T) library(plotrix) jpeg("Figure1.1.jpg",width=2000,height=2000,res=300) xgap <- ifelse(as.numeric(results[,1]) > 1.9, as.numeric(results[,1])-0.4, as.numeric(results[,1])) plotCI(xgap,as.numeric(results[,3]),ui=as.numeric(results[,5]),li=as.numeric(results[,4]),err="y",gap=TRUE,sfrac=0.005, xlab="European odds ratio",ylab="African American odds...

Try setting ylab="" in your plot call and use title to set the label of the y-axis manually. Using line you could adjust the position of the label, e.g.: plot(1:length(w), w, type="b", xlab="Number of clusters", ylab="", 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...

I think you can use ylim as follows: y <- data.frame(x=c("a","b","c","d","e","f"), y=c(500,501,502,503,504,505)) ggplot(y, aes(x=x, y=y)) + stat_summary(fun.y=mean, geom="bar") + coord_cartesian(ylim=c(490,510)) The resulting output is as follows: ...

date,highcharts,axis-labels,rcharts

not category but categories. # data df <- data.frame(x = 1:10, y = rnorm(10), s = rnorm(10), z = letters[1:10]) # create plot object p <- hPlot(y ~ x, data = df, size = "s", type = "line") # set axis p$xAxis(categories = as.character(seq(Sys.Date(), by = 1, length.out = 10)))...

javascript,sorting,d3.js,axis,axis-labels

As per Lars's recommendation in the comments above, you can use .tickFormat() to transform the value with the year into a value without the year. Here's a modified fiddle. I disabled your slicing of the keys (but did it in a lazy way by just commenting out the slicing part...

Problem 1: I don't think you can make the chart leave the empty space to the left. Instead a simple workaround should do: Display the Y-Axis but make the labels transparent! See here for a similar example! That will take the space without showing much more than maybe a few...

python-2.7,matplotlib,axis-labels

You can set what ticks you want in plt.yticks() , the input can be a numpy array which you generate beforehand import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator import numpy as np fig, ax = plt.subplots() fig.set_facecolor('white') yticks = np.arange(1,3,0.2) x = [1,2,3] plt.subplot(211) plt.plot([1,2,3], label="test1") plt.plot([3,2,1], label="test2") plt.xticks()...

You can eliminate the space between the plot and the axis by adding expand = c(0, 0) to the scale parameter:scale_x_discrete(expand = c(0, 0)) You can eliminate the legend by adding show_guide=FALSE to e.g. the geom_line part of your code. EDIT: I think your are trying to plot to...

I'd suggest to create another column in your data frame, which will contain labels, and then use it as x: results$label <- paste(results$Name,results$Tutor,sep='\n') ggplot(results, aes(y=Percent, x=label, colour=Test, fill=Test)) + geom_bar(stat='identity', position='dodge') + ggtitle('Test Results') + ylab('Percent') ...

Building on @Stibu answer and comment, this solution takes into account number of groups and uses the intelligent splitting developed by Stibu, while adding a fix for words separated by a slash. Functions: #Inserts newlines into strings every N interval new_lines_adder = function(x, interval) { #add spaces after / x...

python,matplotlib,axis-labels,axes

Just use a NullFormatter ax = plt.gca() ax.yaxis.set_major_formatter(matplotlib.ticker.NullFormatter()) plt.draw() ...

Am I missing something? Why not use semilogy? x = -3:0; y = 10.^x; semilogy(x, y); set(gca, 'YMinorGrid', 'on') ...

In the first instance the paste call is entirely superfluous since the argument is a valid R expression: mtext(expression( italic("h") ^ italic("2")), side=2, line = 2) # works In the second instance paste is also unnecessary: mtext(expression( italic("I") [italic("a")] ),side=2, line=2,cex=cexm) The argument to the plotmath-"[" function needs to be...

android,axis-labels,mpandroidchart

Version 2.0.0-beta was released over the weekend with a CombinedChart, which allows plotting Line-, Bar-, Scatter- and CandleData in one chart. So the feature is finally available. One note about what I found during my upgrade, you can't simply addDataSet() for each one, you have to generate the individual DataSet...

python,matplotlib,zoom,axis-labels

You just need to create your own tick formatter and then attach it to the axes object. This example has everything you need. Essentially, create a function which takes the value of the tick, and returns what you would like the tick label to be - call it my_formatter, and...

visualization,tableau,axis-labels

Right click on the field in the rows shelf and select "show header" ...

As ye9ane discovered, the problem is caused by setting the text direction to be right-to-left for the jqPlot <div>. In this instance, that is done by setting the text direction in <body dir="rtl">. After checking, I found that problems with right-to-left text direction is a known bug in jqPlot. One...

One approach is to scale your data by 1000 to represent milliseconds from the epoch. Then you can use a SimpleDateFormat with a suitable TimeZone to get the desired effect. DateAxis axis = new DateAxis("Hour"); SimpleDateFormat format = new SimpleDateFormat("H"); format.setTimeZone(TimeZone.getTimeZone("GMT")); axis.setDateFormatOverride(format); The hours are limited to between 0 and...

javascript,d3.js,scatter-plot,nvd3.js,axis-labels

These tick values will not have any effect if the y values themselves are not within the 2-32 range. Right now that chart only has y values up to 2+. So, if in addition to adding chart.yAxis.tickValues(['2','4','8','16','32']); to the Chart Code/Javascript tab as you have in your question, you also...

You could do it like this, by finding the top left corner and fixing it to it. par(mar=c(4,6,4,4)) plot(rnorm(100), ylab="") loc <- par("usr") text(loc[1], loc[4], "Label", pos = 2, xpd = T) Playing around with pos and adding adj could change the position a bit. ...

r,plot,ggplot2,legend,axis-labels

You can add the guide-box of the lhs plot on on top of the plot using gtable_add_grob. This looks like that dimGB1 <- c(subset(g1$layout, name == "guide-box", se = t:r)) g <- gtable_add_grob(g, g1$grobs[[which(g1$layout$name == "guide-box")]], dimGB1$t, dimGB1$l, dimGB1$b, dimGB1$l, z=-Inf) Note that z = -Inf puts the new grob...

You seem to be looking for the length.out argument of seq rather than the by argument. That is, scale_y_continuous(breaks = seq(y_min, y_max, length.out = 6)) You may want to wrap the sequence in round() to avoid undue precision....

You should be able to set the position of the label: ...

java,javafx-8,bar-chart,linechart,axis-labels

After looking through the NumberAxis source, I found out that the DefaultFormatter class inside the NumberAxis class is accountable for this. So overriding the toString method of it was enough. myAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(neerslagAxis) { @Override public String toString(Number object) { if ((double) object < 0) { return ""; } else {...

This seems to work just fine for me: df1b <- df1 df2b <- df2 df1b$var <- as.integer(as.character(df1b$var)) df2b$var <- as.integer(as.character(df2b$var)) graph<-ggplot(df2b, aes(var,mod, group=1))+ geom_smooth(aes(color="red"), se=F, linetype="dotted", size=1)+ geom_line(data=df2b,aes(var,low, color="red4"), size=1)+ geom_line(data=df2b,aes(var,high, color="red4"), size=1)+ geom_ribbon(data=df2b, aes(var,ymin=low,ymax=high), fill="lightpink", alpha=0.4)+ geom_smooth(data=df1b, aes(var,mod, group=1, color="green"), se=F,...

matlab,plot,matlab-figure,axis-labels

Step size depends on what unit you use. I can give an example where you use day as a fundamental unit. The following code need to be made simpler to work with but this shows the principle in an easy way. time = [1/100:1/100:1, 1+1/300:1/300:2, 2+1/200:1/200:3]; data = [3*rand(1,100), 0.5*rand(1,300)-1,...

#Dummy data Data1 <- data.frame(flow = c(8000,8.5,6,7.1,9), SP_elev = c(20,11,5,25,50)) Data2 <- data.frame(flow = c(7000,7.2,6.5,8.2,8.5), SP_elev = c(13,15,18,25,19)) Data3 <- data.frame(flow = c(2000,3,5,7,9), SP_elev = c(20,25,28,30,35)) Data4 <- data.frame(flow = c(1000,4,6,8,9), SP_elev = c(13,15,18,25,19)) Data5 <- data.frame(flow = c(1000,4,6,8,9), SP_elev = c(13,15,18,25,19)) Data6 <- data.frame(flow = c(1000,4,6,8,9), SP_elev = c(22,23,25,27,29))...

You can use .tickFormat() to suppress the labels for those particular values. As the thing you want to check isn't part of the data that's available to the scale, you'll need to find it in your entire data: yAxis.tickFormat(function(d) { var val = 0; dataSet.forEach(function(item) { if(item.Date == d) val...

Maybe I misunderstand you, but it sounds like you want to make your GDI+ graphics scale with the window size (i.e. you want to scale the X and Y axis with the size of the window), right? This is pretty simple, you just have to decide how big of a...

This is not recommended. It is generally considered bad practice to chop off the bottoms of bars. However, if you look at ?barplot, it has a ylim argument which can be combined with xpd = FALSE (which turns on "clipping") to chop off the bottom of the bars. barplot(mtcars$mpg, ylim...

javascript,decimal,scale,axis-labels

var decimal = -Math.floor(Math.log(yMin) / Math.log(10)); ...

python,matplotlib,axis-labels,subplot

You can turn the x and y tick labels on and off manually based on their location in the figure. This demo has some more information. import matplotlib.pyplot as plt fig = plt.figure() # Add subplots nRows = 4 nCols = 2 nPlots = 7 ax1 = fig.add_subplot(nRows,nCols,1) ax1.set_yscale('log') ax1.set_xscale('log')...

python,matplotlib,axis-labels,multiple-axes

I found a workaround that solves the problem, but not by using host_subplot from mpl_toolkits.axes_grid1. Instead, I use matplotlib axes, as follows: fig, ax1 = plt.subplots() ax1.set_xlim(-0.25, 5.1) ax1.set_ylim(-3.75, -13) ax2=ax1.twinx() ax1.set_xlabel('X-label', fontdict=font) ax1.set_ylabel('Y1-label$', rotation='horizontal', fontdict=font) ax2.set_ylabel('Y2-label', rotation='horizontal', fontdict=font) ax2.set_ylim(2.7040e+3, 1.3552e+7) ax2.set_yscale('log') ax1.set_yticks(np.arange(-12, -3, 1.0)) ml = MultipleLocator(0.5)...

python,numpy,matplotlib,3d,axis-labels

You can create a plot that uses spheres instead of circle markers by drawing one at each location as described here. Here's an example: import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt def drawSphere(xCenter, yCenter, zCenter, r): #draw sphere u, v = np.mgrid[0:2*np.pi:20j, 0:np.pi:10j] x=np.cos(u)*np.sin(v) y=np.sin(u)*np.sin(v)...

r,ggplot2,pie-chart,axis-labels

Some months later I've found that the answer lies in using a numeric dummy value for X (rather than a null value "") and then adding limits that are larger than x to the dummy x-axis. Code as below. The issue then becomes adjusting the axis labels in to align...

datetime,highcharts,formatting,axis-labels

You can use the xAxis.labels.formatter function to specify exactly what you want to show as xAxis labels: labels: { formatter: function() { var date = new Date(this.value); var month = date.toDateString().substring(4,7); var day = date.getDate(); if(this.isFirst || day == 1) return day + '. ' + month; return day; }...

Just make custom axes with axes = FALSE and ?axis You can clean up your code substantially: Visit_Curve <- read.table(header = TRUE, text = "Tenure Type Visits Members Percent 1 0 Basic 122446 283975 0.4311858 2 0 Premium 21190 44392 0.4773383 3 1 Basic 92233 283975 0.3247927 4 1 Premium...

Would treating them as numeric be acceptable? yieldCurveSub$variable <- ifelse(grepl("mo", yieldCurveSub$variable), as.numeric(as.character(gsub("[^0-9]", "", yieldCurveSub$variable))) / 12, as.numeric(as.character(gsub("[^0-9]", "", yieldCurveSub$variable)))) ggplot(yieldCurveSub) + geom_point(aes(x = variable, y = value)) + scale_x_continuous(breaks = c(1/12, 3/12, 6/12, 1, 2, 3, 5, 7, 10,20, 30), labels = c("1 mo", "3 mo", "6 mo", "1 yr",...

You can use the matplotlib.ticker.MaxNLocator to automatically choose a maximum of N nicely spaced ticks. A toy example is given below for the y-axis only, you can use it for the x-axis by replacing ax.yaxis.set_major_locator with ax.xaxis.set_major_locator. If you've got a log plot then you can use matplotlib.ticker.LogLocator with the...

javascript,d3.js,format,scale,axis-labels

D3 doesn't have any built-in provisions for special casing like this, but you can easily do this yourself. For example, to omit the "m" suffix only if the number is at least 0.1, use the following code: .tickFormat(function(d) { console.log(d3.formatPrefix(d)); if(d3.formatPrefix(d).symbol == "m" && d >= 0.1) { return d;...

python,matplotlib,axis,axis-labels

ax.spines['bottom'].set_position('zero') ax.set_xticklabels(labels, rotation = -90

Here is a starting point. data = rand(5, 20); // random data for five countries countries = {'Afghanistan', 'Argentina', 'Australia', 'Austria', 'Belgium'}; // cell array containing the names of the countries H = zeros(size(countries)); hold on H = plot(data', 'Marker', '.', 'LineWidth', 1.0, 'MarkerSize', 16); legend(H, countries) Output: This answers...

What you are doing is plotting the serial date numbers on the x-axis, when I suspect that you actually want to plot the date strings themselves. As such, use the serial date numbers to spawn your plot first, then use the date strings by changing the x-axis labels. BTW, your...

python,matplotlib,plot,axis-labels

The extent parameter alters the ticks displayed on the imshow plot. The extent should be passed a 4-tuple or list with the following meaning: extent=(xmin, xmax, ymin, ymax). The y-axis can be inverted by passing origin='lower' to imshow. import numpy as np import matplotlib.pyplot as plt mydata = np.random.random((10,10))...

matlab,plot,matlab-figure,axis-labels

You can do something like the following. In comparison to the solution of @Benoit_11 I do use the normal Matlab labels and refer to both axes with handles so the assignments are explicit. Here is the code: % experimental data M(:,1) = [ 0, 1, 2, 3, 4, 5]; M(:,3)...

You use ticker.FormatStrFormatter('%0.0e'). This formats each number with the string format %0.0e which represents floats using exponential notation: import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as ticker x = np.linspace(1, 40, 100) y = np.linspace(1, 5, 100) # Actually plot the exponential values fig, ax = plt.subplots()...

To make things easy, convert your date strings to a proper date format and then you don't have to worry about ordering them yoruself by default, the vertical alignment is 1 which puts the tick labels to the right of ticks, 0 to the left, and .5 for centered....

One option is to specify the line argument to mtext(). In the example below I add a couple more lines to the right (side = 4) margin of the plot using par(), and then I draw three labels using mtext() at the default (line = 0), line 3 (line =...

javascript,highcharts,label,axis-labels

Why don't you use tickPositions or tickPositioner? You can use them to manually tell the xAxis to show labels in 20 years interval OR latest year available as you said: tickPositioner: function () { var positions = [], tick = Math.floor(this.dataMin); while (tick < this.dataMax) { positions.push(tick); tick += 20;...

I've a couple of problems with your code. First, it doesn't work (and I mean it doesn't work even when I make all the mock sample data). Second, it's not really a minimal working example showcasing what's wrong, I can't figure out what your date is, I presume matplotlib.dates? Third...

There is a lattice option called skip.boundary.labels. From the documentation under ?lattice.options: skip.boundary.labels Numeric scalar between 0 and 1. Tick marks that are too close to the limits are not drawn unless explicitly requested. The limits are contracted by this proportion, and anything outside is skipped. The default value of...

You want to name the axis in the ggplot definitions. This is not possible at the position where you do it now where you are defining a new name (as a string) for the levels. What happens now is that PM[10] will be recognised and read as a string. Add...

you can try this p+scale_x_discrete(label= c("15"="low", "55"="high")) ...

You have to use axis() to specify on which axis las applies. Also you need to specify the points at which you want the tick marks. The seqIplot uses a 0-1 scale and makes some adjustment at the start. Moreover, to rotate the labels, you have to spare some place...

Thanks to rawr I found the answer: par(cex.axis=2) plot(perf) ...

highcharts,axis-labels,column-chart

I think you should using categorized xAxis. Then you need just two small changes: set xAxis.type = 'category' change years into strings: 2008 -> "2008" Demo: http://fiddle.jshell.net/3bcb8sxw/4/...