Skip to content
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

better checking for invalid plot options #19087

Open
kcrisman opened this issue Aug 25, 2015 · 4 comments
Open

better checking for invalid plot options #19087

kcrisman opened this issue Aug 25, 2015 · 4 comments

Comments

@kcrisman
Copy link
Member

Sage 6.5

sage: polar_plot(sec(x),(x,-pi/8,pi/8),ticks=[.1,None],aspect_ratio='auto')
/Users/.../sage-6.5/local/lib/python2.7/site-packages/IPython/core/formatters.py:239: FormatterWarning: Exception in text/plain formatter: Expand the range of the independent variable to allow two multiples of your tick locator (option `ticks`).
<snip>
KeyError: 'text/plain'

Current beta:

sage: sage: polar_plot(sec(x),(x,-pi/8,pi/8),ticks=[.1,None],aspect_ratio='auto')
/Users/.../sage/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py:570: RichReprWarning: Exception in _rich_repr_ while displaying object: unsupported operand type(s) for /: 'float' and 'str'
  RichReprWarning,
Graphics object consisting of 1 graphics primitive

But no graphic shows up. This warning is obviously much less helpful. It is true that the warning in both cases only appears once. Still this seems to be a fairly major regression.

CC: @vbraun

Component: graphics

Issue created by migration from https://trac.sagemath.org/ticket/19087

@kcrisman kcrisman added this to the sage-6.9 milestone Aug 25, 2015
@vbraun
Copy link
Member

vbraun commented Aug 25, 2015

comment:1

Its aspect_ratio='automatic'. Really the fault of plot for not verifying input and then tripping over its feet with useless diagnostics when its time to display the plot.

@kcrisman
Copy link
Member Author

comment:2

I thought we had a 'auto'=='automatic' in that event? Man, I really have not been keeping up.

sage: polar_plot(sec(x),(x,-pi/8,pi/8),ticks=[.1,None],aspect_ratio='automatic') 
/Users/karl.crisman/Downloads/sage/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py:570: RichReprWarning: Exception in _rich_repr_ while displaying object: Expand the range of the independent variable to allow two multiples of your tick locator (option `ticks`).
  RichReprWarning,
Graphics object consisting of 1 graphics primitive

It still shouldn't say it returns a graphic object, should it?

@vbraun
Copy link
Member

vbraun commented Aug 25, 2015

comment:3

plot() does return a graphics object, this is precisely what is wrong with plot. It shouldn't return a graphics object if the input is invalid. But it does, and the graphics object can't display itself graphically.

@kcrisman kcrisman changed the title incredibly non-useful warning in plot replaces helpful warning message better checking for invalid plot options Aug 25, 2015
@kcrisman
Copy link
Member Author

comment:5

Note that in the previous incarnation it didn't actually return anything, there was a KeyError...

@mkoeppe mkoeppe removed this from the sage-6.9 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants