Round to 2 decimal places on range AndroidPlot - androidplot

I am using AndroidPlot to create a simple XYPlot.
My y axis is (by default) rounding up to 1 decimal place. How can I change this to 2 decimal places?
I have found another answer that shows how you would do something similar with the old version of AndroidPlot: (this gets rid of decimal places but I assume this is the same function I would use)
// Gets rid of decimal places
mySimpleXYPlot.setDomainValueFormat(new DecimalFormat("0"));
Does anyone know how to do this with AndroidPlot 1.*?
Thank you!

Since support was added in 1.x to display labels along any of the four edges of the graph, the way to attach a formatter was modified to support an arbitrary edge.
If you're using the standard domain value labels along the bottom of the plot, this should give you the same behavior as before:
plot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.BOTTOM)
.setFormat(new DecimalFormat("0.0"));

Related

Decimal places in annotations of forest plots generated with the metafor package

In a previous post about significant figures displayed in forest plots generated with the metafor package , option digits was suggested to specify the number of decimal places for tick mark labels of the x-axis and plot annotations.
Is it possible to specify a different number of decimal places for different parts of the annotation, i.e. 1 decimal for the weights, more than one decimals for the effect sizes, and, if so, how?
Not at the moment. But I think this is a useful feature (showing many digits on the weights is often not that useful, so being able to adjust the number of digits for the weights separately from what is used for the effect size estimates and the x-axis labels makes sense). I have just pushed an update to the development version of metafor that allows you to specify 3 values for digits, the first for the annotations, the second for the x-axis label, and the third for the weights. You can install the development version as described here:
https://github.com/wviechtb/metafor#installation

how to present negative value with log scaling in paraview

I am trying to display the physical quantity of each vertex in the mesh by paraview.
The ranges of the physical quantity ranges from positive to negative.
I want to display both positive and negative values in log scale in paraview in the same way as proposed by Alan in 2014.
That is
I propose that we find maxVal = max(maximum, abs(minimum)). Then, we set the color bar to run from maxVal to -maxVal. We log scale the top half of the color legend, running from maxVal to maxVal*10^-4, and we reverse log scale the bottom half of the color legend, running from -maxVal*10^-4 to -maxVal.
(As he said -4 is an arbitrary parameter.)
One question is that
I think this proposal has not implemented in paraview(I use version 5.2),
is it right?
And another question is that is there a way to draw colors as Alan proposed in paraview?
It has not been implemented as of ParaView 5.4, and it is currently not possible to achieve that coloring.

Graph comments in a graph like a label?

I have come across this several times and I was wondering if it is possible at all.
Let's say I have 3 columns, one with numerical values, one with time values and a third column with text (1-3 words). I then create a graph with the numerical values (y axis) and the time (x axis). When I then hover over the individual data points on the graph it shows me their numerical values. Is there a way to also show the text associated with that value?
To put it in context, I am plotting noise values for a day and would love to hover over the graph, in particular the peaks and then have a text appear that tells me what the noise was related too, what noise source (e.g. airplane, truck etc).
Is this possible? I was thinking of maybe plotting a second axis for the comments and maybe just plot them all at the same y value but then I am still left with the question on how to display the text comment?
Any ideas?
Cheers
Sandra
Tushar Mehta has an add-in for that here
It has been tested for Excel 97 to 2002, which are all pretty old versions.
The charting engine has changed completely fromexcel-2007, and the menus have gone, so chances are that this tool may no longer work.
I have not seen anything like this done in more recent Excel versions. Probably because it is not an easy task to achieve.

Box plot with labels and axes, fitted to a div with fixed dimensions

Following the provided example I built a function that draws a box plot to a jQuery accordion tab, which has a certain fixed height & width. The amount of distinct categories varies greatly depending on the incoming data. Currently I'd like to achieve the following in the plotting:
1) Add axes and display labels, like in this picture
2) Always fit the boxes to container width and height. Currently I see that if there are too many categories, some of them end on the second row, ensuring they're not fully seen. In the picture, the div contains 7 boxes but only 4 fit on one row:
The question is how can these two be implemented? I couldn't even figure out a way to reliably reduce the padding between the boxes without eating into the side numbers on the boxes.
I adopted the original d3.js example to include axes:
http://bl.ocks.org/jensgrubert/7789216
Instead of using individual svg elements as in Mike's implementation, here all boxplots are rendered with in one root element. This makes it easy to add axes.
Best,
Jens
For the time being I'm using a hack found at Highcharts forum (jsfiddle here). There's also a box plot implementation made with Raphael.js that looks cool (github, example)

Excel chart: on/off values with timestamp

I have 3 columns of data, eg:
http://i.stack.imgur.com/XjGmu.jpg
When Excel creates a line graph of this, the blue line is what i get.
This is not correct because the time stamp shows the time when something is switched on (255) or off (0) (could also be the current state eg 16:08). So I'd like a graph like this - see the red line (with a time-based X axis off course):
http://i.stack.imgur.com/vNvPk.jpg
Anyone can help? Thanks
As #Jon49 indicated, you need to plot additional data points--two y values for each x value: one to plot the point at y=255 and one to plot y=0.
If the time-span of the data is at least a few days, you can use a line chart. But in your case since the values are within a day, the scatter chart with straight lines is the only option due to the limitations of the scale units for line charts.
The key is the values need to be in the correct order. Each y=255 value needs to be followed by the next time-stamp's 255 value followed by it's 0 value, followed by the next time-stamp's 0 value:
Excel doesn't support this type of discrete value graph (at least not excel 2k3 that I am using); your best bet is to use a bar graph and then go into the settings and set the gap width down to zero.
Not sure what the best way is but I would automate what I describe below on how to do (unless this is a one time deal, then just brute force it):
Separate the 255s from the 0s. Make sure for every 0 time there is a corresponding 255 time. Take the zero times and put in a scatter plot then add a y-error bar and make the fixed value equal to 255. Format to how you like it.
Now for the 255s. Add those to the chart by pairs. Make the chart type for these pairs scatter plot with a line. Format how you would like them to look.
Let me know if that doesn't make sense to you.

Resources