Closed seisman closed 4 years ago
Oo, those warnings definitely aren't nice to have, and yes, the example could definitely look a bit nicer, I got carried away with the different positioning methods at #373
- calling
colorbar
with very few arguments, using the default location and default size
From memory, I don't think there's a default position and/or box (unlike legend
which does). Will probably need to wrap in a few more long aliases to fig.colorbar
to make this easier.
- the easiest way (using J) to plot colorbars outside the basemap.
Yes, this would be good to show.
Maybe we could reproduce (a subset) of the colorbars plotted at https://docs.generic-mapping-tools.org/latest/cookbook/cpts.html?
From memory, I don't think there's a default position and/or box (unlike
legend
which does). Will probably need to wrap in a few more long aliases tofig.colorbar
to make this easier.
There are defaults. Try this example:
import pygmt
fig = pygmt.Figure()
fig.basemap(region="0/10/0/10", projection="X10c/10c", frame=True)
fig.colorbar(cmap="vik", frame=True)
fig.savefig("map.pdf")
However, I still don't like this one, because usually, what we do is calling makecpt
to create a "current" cpt, plot some thing, and then calling colorbar
without using cmap
.
From memory, I don't think there's a default position and/or box (unlike
legend
which does). Will probably need to wrap in a few more long aliases tofig.colorbar
to make this easier.There are defaults. Try this example:
import pygmt fig = pygmt.Figure() fig.basemap(region="0/10/0/10", projection="X10c/10c", frame=True) fig.colorbar(cmap="vik", frame=True) fig.savefig("map.pdf")
However, I still don't like this one, because usually, what we do is calling
makecpt
to create a "current" cpt, plot some thing, and then callingcolorbar
without usingcmap
.
Ah ok, then we should definitely show that this default position/style exists. I've opened a PR at #596, feel free to experiment on that branch or offer suggestions.
Description of the problem
We already have an example for colorbar in the gallery (https://www.pygmt.org/dev/gallery/plot/colorbar.html). However, the example is a little low-quality.
The example gives many warnings like:
The example is not beautiful at all. The main reason is that the figure size is too small and the colorbars are too large.
The example is not as usable as I expect. I believe very few people will plot colorbars inside a frame. IMHO, at least we should show
colorbar
with very few arguments, using the default location and default size@weiji14 As the example was created by you, I'd like to hear what you think. You can improve the example if you like.