-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Figure.legend to read from StringIO #571
Comments
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct. |
That's a good point. Currently PyGMT doesn't support StringIO, but I agree it should.
A quick answer to your question: GMT6 supports a feature called "auto-legend". For See this example for how it works. For detailed syntax, please refer to the GMT -l option. |
Hi @dr-glenn, could you provide an example on how you are writing to the io.StringIO buffer? I know pandas has a
I'll second this. There's at least two ways this can be implemented:
|
I apologize for not answering the request for example much sooner. This example is quite trivial and you may well wonder why I care at all - it's just that I don't like writing files when not needed, plus many Python functions expect a file pointer/buffer object rather than a filename.
|
FYI, @seisman has implemented option 2 from #571 (comment) ("let the GMT C API read from the StringIO buffer directly") at #3438 (there's an example in that PR on how to pass in an |
I need to display a legend of symbols for the magnitude of earthquakes. Currently the legend specification must be a file on disk. The Pythonic implementation should allow Figure.legend(spec=<buffer|file>,...). My preference is to write the legend specification to io.StringIO buffer and then use the buffer for Figure.legend. Instead I have to generate the legend spec in program and write to a file and then specify spec='my_legend.txt'.
Figure.legend has default arg spec=None. I have no idea how this default works, that's a separate issue: improve documentation.
I am willing to implement, but have no experience with such participation.
The text was updated successfully, but these errors were encountered: