-
-
Notifications
You must be signed in to change notification settings - Fork 991
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
re: Textual contours example #4
Comments
I can help testing if it is what you mean. For the textual contour example, I simply used TextPath along the contour path but it is kind if limited because there may be sharp turns in the contour that make text unreadable. I guess for the general case, straight labels are probably the best option but I can check what are the alternatives in other software/libraries. And I can send you my code of course. |
It's mostly just that Matplotlib's current contouring code has some defects wrt. the way the breaks in the contour are determined (on the image on the left (which I guess is "plain matplotlib"?) the breaks are clearly too big), and also there may be nicer ways to format the texts (e.g. using ScalarFormatter is likely more robust (e.g. wrt. trailing zeros) than a fixed format string, and will use mathtext if that's what you have in the rcParams (so in your image the "minus" will be an actual minus sign, not a dash -- actually that may be nicer on the image on the right too)). I don't know to what extent you directly reused Matplotlib's contour code as opposed to rewriting things from scratch, but wanted to point out that if you did reuse Matplotlib's contour code then there may be some low-lying improvements possible for you as well. |
I reused the contour directly from the contour.collections then I interpolate the vertices to fit the text. I think one (big) difference is that I use TextPath whose size is in data space and it simplifies everything in my case. Not sure about the origin of the large gap you mention but I can imagine it might be quite hard to fit "perfectly" a regular text. |
Yes, that looks good. The point about using mathtext (even manually, if you prefer) remains, though. |
You may be interested by matplotlib/matplotlib#16171?
The text was updated successfully, but these errors were encountered: