How to add anotations to points created with matplotlib.patches.circle? - python-3.x

I've got an image with circles plotted on top using matplotlib.patches.Circle which worked fine here:
I was just wondering if it is possible to add annotations to the circles using the same class Circle as in the second image (two of the circles have manually added annotations 1 and 2)
I know there is a possibility to add a legend to the circles but I need to have the information next to the circles and not as a separate box.

Related

Why does my cube in three.js have aliasing and look "Jaggy"?

I am using three.js and created a basic scene with a few meshses rendered with some basic lighting . My torus geometry was previously pointy with few polygons but I was able to smooth it out by adding more segments but now I would like to straighten the lines out in my cube. They seem jaggy. In the pic I am including my render on the left seems a lot jaggier then the example I am following on the right. I have even set width and height segments to very large values (200). Any Ideas why the aliasing/jagginess?My render on left, example on right

Fabric JS object scaling

I have grouped a set of six squares that form a rectangle and placed a set of 12 circles at the vertices onto the canvas. The first screen shot below shows the unscaled version. The issue is that the rectangle object height and width do not change as I scale it up or down. See the second screen shot.
I have tried to scale up or down and check the dimensions of the rectangle using two methods
1) canvas._objects
2) canvas.getObjects()
Neither of these objects reflect the new dimensions of the scaled group of squares. This must be an error in Fabric JS unless someone can suggest a workaround. Your input is appreciated.
you need to use the scaleX/Y factor from the rect object to calculate the stretched height/width.

gmtset BASEMAP_FRAME_RGB transparency

I want to not have my basemap axes visible for an image I'm making in GMT with several plots in it. So far I have made them white using:
gmtset BASEMAP_FRAME_RGB = white
However some of the plots partially overlap and the white axes can be seen over the plots - any ideas on how to fix this? By making the basemap frame transparent ideally.
In fact I've realised I can change the order I do the plots in so that the overlap doesn't matter - also replaced -B... with -G255 to plot on a blank square.

AndroidPlot - Position TextLabelWidget not consistently on different devices

I have a chart show info of apps, but when run it on devices android. The position of text on chart not consistently.
These images illustrate the problem: https://drive.google.com/folderview?id=0B7-CxJHQ5ZnjYjVlTlFQdElWRGM&usp=sharing
I use TextLabelWidget in AndroidPlot. How to keep position of TextLabelWidget on chart with the same image1 in link above on devices?
The problem appears to be that your plot area is set to fill the width of the screen and since the bars are evenly distributed in that space, their x positions are essentially fractions of the screen width.
At the same time you have labels that appear to be positioned using absolute positioning. As an example, this code will position 4 labels at 0%, 25%, 50% and 75% screen width, 80 pixels down from the top of the screen:
txtWidget1.position(0, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
txtWidget2.position(0.25f, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
txtWidget3.position(0.50f, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
txtWidget4.position(0.75f, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
There are some other factors that you are also probably going to need to deal with such as bar width but this should get you closer. You may find this doc useful as far as a guide for the different positioning methods.
Another tool to consider using if you aren't using it already is the Configurator. This will let you set your positions etc. inside xml and override values based on screen size, orientation, etc.

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.

Resources