axis-labels

D3 grouped bar chart: How to rotate the text of x axis ticks?

前提是你 提交于 2019-12-05 07:54:25
I'm using the Grouped Bar Chart( http://bl.ocks.org/mbostock/3887051 ), but the text of the x-axis is very long, as shown in attached picture. How to rotate the text? Thank you. VividD A reasonable solution can be found here The result looks like this: Make sure you fully understand this portion of code: svg.append("g") .attr("class", "x axis") .attr("transform", "translate(0," + height + ")") .call(xAxis) .selectAll("text") .style("text-anchor", "end") .attr("dx", "-.8em") .attr("dy", ".15em") .attr("transform", "rotate(-65)"); -65 is the angle the label text is rotated, in degrees. Also, you

Setting x and y labels with holoviews

拈花ヽ惹草 提交于 2019-12-05 05:16:34
I would like to change the labels on the x and y axis on a figure from holoviews to be something other than the internal variable name. It seems the typical way to affect the axis labels is to change the variable names themselves to the label. This is rather inconvenient if you want complex labels, especially if you are frequently converting from other complex data objects like pandas dataframes. Is there a general way to either: (A) change x and y labels of a figure as or after you plot it or (B) set up an human readable alias for variable names? You can change the axis labels as or after you

how to subscript the x axis tick label

夙愿已清 提交于 2019-12-05 02:25:36
I generated this graph with the below script. But how could I subscript the "10" in PM10, "2" in SO2, and"2" in NO2? I tried levels(df$variable) <- c("PM[10]","SO[2]", "NO", "NO[2]") , but does not work. Can anyone help? Thank you! variable <- c("PM10","SO2","NO","NO2") coef <- c(10,20,30,40) coef_lb <- c(-5,10,23,27) coef_ub <- c(20,39,39,50) df <- as.data.frame(cbind(variable, as.numeric(coef),as.numeric(coef_lb),as.numeric(coef_ub))) df$variable <- factor(df$variable,levels=c("PM10","SO2","NO","NO2")) levels(df$variable) <- c("PM[10]","SO[2]", "NO", "NO[2]") library(ggplot2) #ggplot 95%CI

How to lengthen specific tick marks in facet gridded ggplot?

北战南征 提交于 2019-12-05 01:18:19
问题 I want longer tick marks for those with labels in a facet grid. So I worked through this attempt and tried to adapt it to facet gridded plots like so: Defining breaks and labels, minor and major: range.f <- range(unique(df1$weeks)) minor.f <- 1 # every 1 week, NOTE: range.f[2] should be divisible by minor.f! major.f <- 5 # every 5 weeks breaks.f <- seq(range.f[1], range.f[2], minor.f) every_nth.lt <- function (x, nth) {x[1:nth != 1] <- ""; x} # (lite version of https://stackoverflow.com/a

Change font-size of domain axis label and range axis label for jfreechart

有些话、适合烂在心里 提交于 2019-12-05 00:11:42
My goal is to increase the size of "Revenue ($) " and "Years" . But I do not know how. I am able to increase the "Apples, Durians,Oranges" and "2012, 2013". Below are my codes. JFreeChart chart = ChartFactory.createBarChart3D("", // chart title "Years", // domain axis label "Revenue ($)", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend false, // tooltips false); CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis axis = plot.getDomainAxis(); CategoryPlot p = chart.getCategoryPlot(); ValueAxis axis2 = p.getRangeAxis(); Font font = new

Google Chart Tools truncating y axis labels

扶醉桌前 提交于 2019-12-04 22:26:27
Working with a Google bar chart , here is what I got: Here my custom options var options = { width: 500, height: 240, legend : 'none', vAxis:{title:'Answers',textStyle:{color: '#005500',fontSize: '12', paddingRight: '100',marginRight: '100'}}, hAxis: { title: 'Percentage', textStyle: { color: '#005500', fontSize: '12', paddingRight: '100', marginRight: '100'} } }; Can't I set a width for these <g> / <rect> tags? I believe the chartArea.left option is what you are looking for. Try something like this, and mess around with chartArea.left and chartArea.width values (should add up to your total

d3.js axis labels - color not changing

爷,独闯天下 提交于 2019-12-04 22:24:54
I'm creating my axis with the following text, however the color of the labels is not changing properly; the color the text remains black. Does anybody know why? // create Axis svg.selectAll(".axis") .data(d3.range(angle.domain()[1])) .enter().append("g") .attr("class", "axis") .attr("transform", function(d) { return "rotate(" + angle(d) * 180 / Math.PI + ")"; }) .call(d3.svg.axis() .scale(radius.copy().range([-5, -outerRadius])) .ticks(5) .orient("left")) .append("text") .attr("y", function (d) { if (window.innerWidth < 455){ return -(window.innerHeight * .33); } else{ return -(window

How to set scientific notation on axis in matplotlib

半世苍凉 提交于 2019-12-04 21:40:37
I am trying to plot a graph with two separate x-axis. One being some valve openning and the other the corresponding leak rate. I managed to make it work pretty well, though the format of that secondary axis doesn't always show scientific notations as seen on the figure down bellow Awful overlapping labels, see the upper axis How to force scientific notation display so that the labels wont overlap? Here is the script I am using: #HEADERS import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker from matplotlib import rc rc('font', **{'family':'sans-serif','sans-serif':[

jqplot - superscript in axis label

馋奶兔 提交于 2019-12-04 14:38:43
As the title says how do I add superscript fonts to the axis labels in a jqplot graph? I tried using Javascript sup() function and also actual html tags for the titles of the axes but to no vain. Basically I need to display units like m 3 etc. Do I have to tinker with the AxisLabelRenderer or is there any obvious workaround I am missing? Thanks. You can use unicode characters for do that; "Superscript two"(\u00B2) (2) "Superscript three" (\u00B3) (³) "Superscript one" (\00B9) (¹) try this: xaxis: { label: "Units m\u00B3" }, Here's another answer, with HTML entities, which also works in jqPlot:

How to format the x-axis of the hard coded plotting function of SPEI package in R?

本小妞迷上赌 提交于 2019-12-04 04:46:20
问题 I am using the SPEI package along with its sample monthly data of 32 years. I want to modify the x-axis labels to reflect the years not the numbers. However, the hard coded plotting function won't allow me to do this. I tired to extract the SPEI$fitted data and tried to replicate the same plot with ggplot but did not succeeded. Here is the sample code install.packages("SPEI") library(SPEI) data("wichita") wichita$PET=hargreaves(Tmin=wichita$TMIN, Tmax = wichita$TMAX, lat = 37.64) wichita$BAL