Bokeh add label to second axis on the right - bokeh

I am creating a bar chart using Bokeh, and I want to display 2 independent sets of data. I have added another y-axis to the right side of my plot using the following
bar2.extra_y_ranges = {"Mtons": Range1d(start=0, end=2000)}
bar2.add_layout(LinearAxis(y_range_name="Mtons"), 'right')
How do I add a label for the second axis?

LinearAxis has a parameter axis_label. This can be set by editing the call to LinearAxis as follows:
bar2.add_layout(LinearAxis(y_range_name="Mtons", axis_label="Mt CO2e"), 'right')

Related

PHPExcel Chart X-Axis Between Tick Marks

I'm working on an old script and I've hit a problem for a configuration that does not appear to be documented. I have a dynamically created bar chart. The bars are vertical. Everything is fine except the position of the bars on the X axis. The first and last one are half cut off. I can fix it easily after producing the spreadsheet. I click on the X-axis and switch the position to "Between tick marks" instead of "On tick marks." I cannot find anything in any form of PHPExcel documentation for setting the position of the X axis to "between" instead of "on." Does this setting exist?
PHPExcel has been replaced by PHPSpreadsheet, but there are cases where it is not possible to change from PHPExcel to PHPSpreadsheet.
The option that must be set is "crossBetween" for the X Axis. PHPExcel does not make this a customizable option. It is hard-coded in Charts.php with the value "midCat". That setting places the first bar directly under the Y axis and the last bar hanging off the right side of the chart. Each bar is cut off. To place the bars between the ticks, edit Charts.php and change the entry for "midCat" to "between". You should only find "midCat" once in the file. This will hard-code all charts to be between the ticks. Change it back if you want it back to what it used to be.
The proper fix is to make this an option you can change. That requires editing multiple files. The Axis object needs a cross_between option. Then, a setter is needed to update that option. The writer needs to pull from that option instead of hard-coding the value. Chart lets you get the X Axis, but you can't set it once you update an option. So, you need a setter for the X Axis for the chart. Then, you can create a chart, get the X Axis, change the crossBetween value, and set the updated axis in the chart.

ggplot2 add text in the legend area

I would like to add some totals on the right side of the plot (above and under the legend). And also under the title of the x axis.
I found how to add text within the plot, or add multiple legends of something ploted, but I don't want to do either one. I just want to calculate some totals and display them as mentioned above. Is it in any way possible?
As it is now:
As I would like it to be:

How to change individual panels in R dotplot

So I have a dotplot with 4 panels, each panel has 6 horizontal bars. I'm trying to make it so that when a bar is past a certain X value (denoted by reference line), it will be a different color. I cant find anything that will make R do this automatically, soI figured there must be a way to manually tell it to make a specific row of a specific panel a certain color?
Heres my code:
dotplot(somematrix,groups=FALSE,
layout=c(2,2),aspect=1,
origin=0,type=c("p","h"),
main="Main label",
xlab="X label",
scales=list(x=list(tck=0, alternating=TRUE)),
panel=function(...){
panel.fill(rgb(.9,.9,.9))
panel.grid(h=0,v=-1,col="white",lwd=2)
panel.abline(v=20,col="red",lwd=3)
panel.barchart(col=c("blue","blue","blue","blue","red","blue"),cex=1.1,...)
}
)

How to add titles below the bars in Bar CHart created from Core Plot?

Hi I need to show the String titles below the bars of my Bar Chart created from Core Plot. I have many places in Core Plot framework but didn't find how to put text below the bars?
I need to show titles just like shown in the attached image.
Please suggest!
There are a couple of ways to make axis labels that are not numeric representations of the data value.
If you are plotting categorical data, you can set the scale type of the plot space to show categorical labels and return the text of the label from the datasource for the plot value (e.g., the bar location for a bar plot).
From the "Vertical Bar Chart" demo in the Plot Gallery example app:
// setup
[barPlotSpace setScaleType:CPTScaleTypeCategory forCoordinate:CPTCoordinateX];
If you're not plotting categorical data or you just need more control over the labels, you can create custom axis labels. Set the axis labelingPolicy to CPTAxisLabelingPolicyNone, create a set of axis labels, and assign it to the axisLabels property. There are several demos in the example apps including the "Composite Plot" demo in the Plot Gallery example app. With CPTAxisLabelingPolicyNone, the tick marks and labels are independent, so if you want tick marks, you also need to set the majorTickLocations and/or minorTickLocations.

How to move the color bar of a heatmap in gnuplot?

I'm plotting some heatmaps in gnuplot. It has the graph and a colorbar in the right side of the graph. But I wish to change it's position in the plot. Does anybody know the command to change the position of the colorbar in the plot ??
Thanks,
Thiago
You can use the command set colorbox:
set colorbox vertical user origin .02, .1 size .04,.8
If you want it anywhere but the default position you have to set the coordinates manually. For more info you can type
help set
in gnuplot and all the options starting with cb and colorbox refer to fine points of the colorbox.

Resources