-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Fix command-line plotting keywords #17284
Comments
This comment has been minimized.
This comment has been minimized.
comment:2
Yeah, I think that was more or less the previous code, huh? But would it break showing graphics correctly in sagenb or ipynb? |
comment:3
This does work here from the command line. The notebook also seems OK. However, the ipynb seems to be malfunctioning. The default in ipynb is Tachyon, i.e. |
comment:4
IPython notebook doesn't support 3d plots yet. |
comment:5
I may be mistaken but on a previous trying of the IPython notebook (when I can't remember) something like |
comment:6
True, but neither is the desired outcome |
Commit: |
Author: Volker Braun |
comment:9
I can't test it out immediately because I don't have time to compile up to rc1 right now, but this seems okay. Only one question - there are other viewers (e.g. canvas3d) available in the notebook, so I assume this code will only be reached in the command line? Currently we get, in the command line,
which isn't all that helpful either, I have to admit. |
comment:10
This shouldn't change anything on SageNB. Other viewers are not supported on the command line, nothing changed there:
Really, the issue is the code quality in the 3d plots. Everything and their dog is lumped in a giant |
comment:11
Why do we reinvent the |
comment:12
In other words, what's wrong with:
Even if there is something wrong with the above, perhaps the right solution is to fix |
comment:13
Replying to @kcrisman:
This is fixed in #16640 by raising a better error message. |
comment:14
Everything is wrong with |
comment:15
Replying to @vbraun:
If your solution is to move stuff from (I have seen the following too often: X is broken. Instead of fixing X, somebody invents Y which is similar to X but with other bugs) |
comment:16
The whole premise of using a handful of global variables to steer the output pipeline is IMHO utter crap. It didn't work well when we had a single Notebook, and it sure as hell is a nightmare if we want to deal with 3 different notebooks at the same time. There needs to be some infrastructure to arbitrate between backend capabilities and user preferences. But I sure as hell don't want to reinvent how |
comment:17
Is this the intended behavior? From the notebook
with no output, which is what I would expect. But from the Sage prompt
and the jmol viewer is spawned. And if |
comment:18
Replying to @vbraun:
I never said that |
comment:19
Had I tacked on the IPython notebook with yet another global variable and extra if branches then it would have caused bugs, too... |
comment:20
Replying to @strogdon:
As far as I'm concerned, this is the regrettable state of current affairs but not really on-topic for this ticket. Sphere should validate input when the graphics object is created, not fall flat on its face later on when it is about to be drawn. |
comment:21
Two comments that hopefully will keep us on target:
No, but I think this was already the case earlier, although the error messages probably will have changed. We can't necessarily validate EVERY input, as I've been told when I've attempted to on many other tickets... incidentally, there is the
This is a noble goal and I totally agree that the 3d graphics show code is miserable due to accretion of layers over the years, but I think it probably isn't really worth the effort to fix that right now because it will be pretty hard to test for all possible bugs easily. On the other hand, putting something like that in an early beta someday when there aren't actual bugs to fix seems fine. It's also worth pointing out that one reason that is so messy is because the actual creation of most plots is viewer-agnostic, which was deemed to be "a good thing" by TBDFL. |
comment:22
Creation of plots should of course be viewer-agnostic. The problem is that the modularity stops there and drops into a monolithic if-branch thicket (that is moreover hard to test). There are more modular problems here, like creating the rendering / viewer files, what to do with the output files, arbitrating capabilities versus user preferences. |
comment:23
I guess you already know the following; I'm just posting for the sake of completeness. The commit which caused the originally reported problem, i.e. opening JMOL instead of a PNG viewer, was caused by commit e7e7f9c by Volker. Which is not surprising in hindsight: it changed the |
comment:24
Thanks for confirming this. If you have already tried this and are satisfied with the code and behavior, feel free to put positive review - I haven't been able to upgrade Sage to the right place yet. |
comment:25
Replying to @gagern:
Which is also precisely why the current |
comment:26
True, though that still might not make dealing with it worth the while as compared to other things one could spend time on. That's why I always visually tested output when I reviewed changes in things related to it, though probably one would want to do so in any case - esp. given that we can't do like mpl and have pre-existing files to test against, at least I don't think so. |
comment:27
Replying to @kcrisman:
We could in theory hash the resulting PNG file and check that in a doctest. However, I don't know how workable that would be in practice. |
comment:28
Apart from testing that the output pipeline ends in the place we thought it ends, we should also compare with the resulting rastered image (though was not what I was talking about previously). We can't do pixel comparisons because that might depend on rounding, installed fonts, and/or freetype version. The classical algorithm for that is to break up your picture in a grid (say, 10x10) and compare the color histogram in each sector with a small tolerance. |
comment:29
Yup, looks good there now that I had a chance, and this does indeed fix the previous problem. |
comment:30
Since several people have commented here, I'm reluctant to be the final one to set to positive review. But FWIW I don't hear any complaints about the code itself, just that Sage and show need help and that some undesirable behavior that isn't documented is or isn't still happening. But the issue at hand seems to be fixed. |
Reviewer: Steven Trogdon, Karl-Dieter Crisman, Jeroen Demeyer, Martin von Gagern |
comment:31
Can somebody grow a pair and set this to positive review already? |
comment:32
I think all the people commenting here didn't really have a problem with the code, since you don't want to push the button yourself Volker I'll do it on behalf of all those commentators. |
Changed branch from u/vbraun/fix_command_line_plotting_keywords to |
This should open a Tachyon-rendered plot (and this worked until very recently):
The following patch fixes the problem (but probably not in the correct way):
CC: @vbraun @kcrisman @strogdon
Component: graphics
Author: Volker Braun
Branch/Commit:
c84805c
Reviewer: Steven Trogdon, Karl-Dieter Crisman, Jeroen Demeyer, Martin von Gagern
Issue created by migration from https://trac.sagemath.org/ticket/17284
The text was updated successfully, but these errors were encountered: