Android plot demo app orientation sensor example history plot line thickness - androidplot

I have been unable to alter the plot line thickness for the History plot in the Orientation sensor Example (OrientationSensorExampleActivity.java)
None of the other queries about line thickness seem to be with the FastLineAndPointRenderer.
Is there an easy way to do this?
I need to make the plot lines thinner (a 100th of the overall height)
Thanks
Dean

The thickness of all lines in Androidplot are controlled by an instance of Paint. In the case of lines drawn by a Renderer (of any kind), it's the formatter that will contain the Paint instance.
Here's an example of setting the line thickness for a formatter used to draw a series with FastLineAndPointRenderer:
FastLineAndPointRenderer.Formatter formatter = new FastLineAndPointRenderer.Formatter(Color.RED, null, null);
formatter.getLinePaint().setStrokeWidth(PixelUtils.dpToPix(3));
plot.addSeries(azimuthHistorySeries, formatter);

Related

Using matplotlib.pyplot.clabel to add labels with a transparent background

For matplotlib.pyplot.clabel, is it possible to add labels to a contour plot without the white space behind the labels covering up any portion the contour lines? When I try to add labels to a contour plot it tends to cover up part of the contour plot with white space. Perhaps there is a way of making the background of the text transparent?
Use the inline argument
plt.clabel(..., inline=False)

OpenLayers 3: align/rotate labels with line features

Is it possible to align/rotate text labels to a line feature? For example, if a line runs southwest to northeast (45 degrees), then the text placement should also be 45 degrees? Is this possible? I did look through the OL documentation but couldn't find anything of this nature.
You can't make a label "follow" a line in OpenLayers 3, but you can rotate it. See in this example: http://openlayers.org/en/latest/examples/vector-labels.html
Try setting the "Rotation" then hit the refresh button and you'll see the label being rendered on that angle.
If you use a style function, you could calculate the average angle of the line to determine the angle to render its label.

gnuplot - why plotted lines disappear after certain zoom in level?

I'm completely new to gnuplot.
I'm trying to plot a couple of trivial series of data on one plot.
Actually I mean a small number of simple segments [x1,y1] -> [x2,y2]
But I noticed an annoying behaviour: when I try to zoom my canvas with mouse into specified location, e.g. lines crossing point, my lines eventually disappear. Not all at once - they
disappear one by one at different zoom levels.
I'm not able to examine specific point from close up because of this.
Is it possible prevent my graph elements from disappearing from window?
The behaviour of the plot when one or both end points of a line are outside the displayed range is controllable with set clip.
To have the line portion drawn which is inside the plot but both endpoints being outside, you must use set clip two.
Consider the following example:
plot '-' with linespoints
0.5 0.5
9.5 9.5
e
If you now zoom in, the line disappears. If you use set clip two before, then you can zoom in and the line is drawn:
set clip two
plot '-' with linespoints
0.5 0.5
9.5 9.5
e
(tested to work with 4.6.5)

Alternative to flot where the axes labels are within the canvas

I have been using the fantastic canvas plotting library flot. The selection of graph types is excellent but I want to be able to export the whole graph to an image, including axes numbers, ticks and labels and a the graph title.
Unfortunately only the graph itself seems to be drawn in the canvas, the axes numbers and ticks are in divs. Therefore the canvas toDataURL method does not capture everything.
Can anyone recommend a library with similar functionality which either:
Draws everything within the canvas, or
Has a reliable export to image method
In particular I would like a library which supports the percentiles plot.
Flot 0.8 supports drawing axis labels to canvas using the canvas plugin. I don't know about the chart title - that depends on what plugin or code you're using to do that - but it would be relatively easy to add a draw hook to render that text to canvas.
The only thing Flot can't currently draw to canvas is the legend; that will be added in the next release.

SetWorldTransform() and font rotation

I'm trying to display text on a Windows control, rotated by 90 degrees, so that it reads from 'bottom to top' so to speak; basically it's the label on the Y axis of a graph.
I got my text to display vertically by changing my coordinate system for the DC by using SetGraphicsMode(GM_ADVANCED) and then using
XFORM transform;
const double angle = 90 * (boost::math::constants::pi<double>() / 180);
transform.eM11 = (FLOAT)cos(angle);
transform.eM12 = (FLOAT)(-sin(angle));
transform.eM21 = (FLOAT)sin(angle);
transform.eM22 = (FLOAT)cos(angle);
transform.eDx = 0.0;
transform.eDy = 0.0;
dc.SetWorldTransform(&transform);
Now when I run my program, the rotated text looks different from the same text when it's shown 'normally' (horizontally). I've tried with a fixed-width (system) font and the default WinXP font. The system font comes out look anti-aliased and the other one looks almost as if it's being drawn in a 1-pixel smaller font than the horizontal version, although they are drawn using the same DC and with no font changes in between. It looks as if Windows detects that I'm drawing a font not along the normal (0 degrees) axis and that it's trying to 'optimize' by anti-aliasing.
Now I don't want any of that. I just want to same text that I draw horizontally to be drawn exactly the same, except 90 degrees rotated, which is possible since it's a rotation of exactly 90 degrees. Does anyone know what's going on and whether I can change this easily to work as I want? I'd hate to have gone through all this trouble and finding up that I will have to resort to rendering to an off-screen bitmap, rotating it using a simple pixel-by-pixel rotation and having to bitblt that into my control :(
Have you tried setting the nEscapement and nOrientation parameters when you create the font instead of using SetWorldTransform? See CreateFont for details.

Resources