CubeBrowser / cube-explorer

browser based exploration of iris cubes
BSD 3-Clause "New" or "Revised" License
8 stars 12 forks source link

Added general AnnotationPlot and Text Element #27

Closed philippjfr closed 8 years ago

philippjfr commented 8 years ago

Adds an Element type to place Text annotations at a coordinate specified in an associated coordinate reference system. The GeoAnnotationPlot baseclass passes the coordinate reference system to the subclasses, which can apply the transform.

Here's an example in action, the text coordinates can be supplied in supported coordinate reference system:

tiles = MapQuestOSM()
hc.GeoTiles(tiles)(plot=dict(projection=tiles.crs, zoom=14)) *\
hc.Text(531738., 180690., 'Some text on the Thames', crs=crs.OSGB()) *\
hc.Points(tube_locations(), crs=crs.OSGB())(style=dict(color='r', s=100, marker=concentric_circle)) *\
hc.Points(tube_locations(), crs=crs.OSGB())(style=dict(color='b', s=100, marker=rectangle))

image

jlstevens commented 8 years ago

Seems fine although I'm not sure how I feel about adding Geo in front of class names. I understand it is to avoid confusion by naming new classes with identical names to those already used in HoloViews. On the other hand, I think that is what namespaces are for. :-)

This is a fairly general concern that isn't specific to this particular PR. I am happy to merge if you think it is ready.

philippjfr commented 8 years ago

On the other hand, I think that is what namespaces are for. :-)

Sure, although they are usually subclasses of their HoloViews equivalents so the HoloViews version would have to be imported as HvTextPlot or something similar.

philippjfr commented 8 years ago

Also, yes it's ready.

jlstevens commented 8 years ago

Sure, although they are usually subclasses of their HoloViews equivalents so the HoloViews version would have to be imported as HvTextPlot or something similar.

That seems like the right approach to me if we believe the subclass offers all the original functionality of TextPlot and more. Anyway, this is a tricky question with no obvious right answer so I won't let it stop me from merging this PR.