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

Allow custom fill endpoints in a filled plot #14599

Open
kcrisman opened this issue May 16, 2013 · 15 comments
Open

Allow custom fill endpoints in a filled plot #14599

kcrisman opened this issue May 16, 2013 · 15 comments

Comments

@kcrisman
Copy link
Member

In this ask.sagemath question, the issue is raised whether

sage: f = x*(x-1)*(x-2)+1
sage: p = plot(f, 0.5, 1.5, fill=True) + plot(f, 0, 2)

should be doable in a single command, such as with a fillxmin/fillxmax keyword (or some better name).

CC: @sagetrac-dsm @vbraun

Component: graphics

Author: Sergey Bykov

Branch/Commit: u/captaintrunky/allow_custom_fill_endpoints_in_a_filled_plot @ 2f0fdcb

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

@kcrisman kcrisman added this to the sage-5.11 milestone May 16, 2013
@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@sagetrac-captaintrunky
Copy link
Mannequin

sagetrac-captaintrunky mannequin commented Nov 11, 2014

@sagetrac-captaintrunky
Copy link
Mannequin

sagetrac-captaintrunky mannequin commented Nov 11, 2014

Author: Sergey Bykov

@sagetrac-captaintrunky
Copy link
Mannequin

sagetrac-captaintrunky mannequin commented Nov 11, 2014

Commit: c4cbac3

@sagetrac-captaintrunky
Copy link
Mannequin

sagetrac-captaintrunky mannequin commented Nov 11, 2014

New commits:

c4cbac3Added custom endpoints in a filled plot

@kcrisman
Copy link
Member Author

comment:7

This is great that you are working on this! I don't see any obvious problems in the code, though I won't be able to look at it more carefully right now. My first thought, though, is what happens with parametric plots? Somehow their fill "magically" works right, and I'm wondering what the behavior might be with this keyword.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

4c8dc26Fixed fill for parametric curves

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2014

Changed commit from c4cbac3 to 4c8dc26

@sagetrac-captaintrunky
Copy link
Mannequin

sagetrac-captaintrunky mannequin commented Nov 12, 2014

comment:9

Replying to @kcrisman:

This is great that you are working on this! I don't see any obvious problems in the code, though I won't be able to look at it more carefully right now. My first thought, though, is what happens with parametric plots? Somehow their fill "magically" works right, and I'm wondering what the behavior might be with this keyword.

Thanks for the feedback. You were right, there was some weird staff with parametric curves. It seems to work fine now, but these new custom endpoints definitely require some additional checks. However, I couldn't break it with my test suite, which contains a set of well-known curves.

@kcrisman
Copy link
Member Author

comment:10

Hmm, maybe you can add some of those to the tests/examples; at any rate, currently your branch has only one non-example, not examples of how to use this. Or, if you have a pretty extensive suite, there are a couple testing-only files out there that could be added to - we love tests!

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 13, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

2f0fdcbAdds some examples of custom fill endpoints

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 13, 2014

Changed commit from 4c8dc26 to 2f0fdcb

@kcrisman
Copy link
Member Author

kcrisman commented Feb 4, 2015

comment:12

Look at the following interesting behavior.

sage: plot([x^3,x^2,x], xmin=0, xmax=4, fill={0:[1], 1:1, 2:1-x}, fillxmin=1, fillxmax=2)

It's definitely obeying the fillxmax but not in the way one might expect.

Similarly, I'm not sure that

sage: plot((cos(x),sin(x)), xmin=0, xmax=2*pi, parametric=True, fill=True, fillxmin=0.5)

is behaving as expected.

And I'm completely flummoxed as to why

sage: plot((cos(x),sin(x)), xmin=0, xmax=2*pi, parametric=True, fill=True, fillxmin=1)
<boom>
KeyError: 'text/plain'

due to the new display hook stuff!

One possible workaround would be to disallow the custom fill (for now) in parametric plots (i.e. raise an error) and make that a new ticket. I do think that the first 'bad' example should be dealt with, though.

@vbraun
Copy link
Member

vbraun commented Feb 4, 2015

comment:13

the problem is probably that the plot object is invalid (it can't actually show a plot). Because there is insufficient validation this only causes issues later when you actually try to plot it.

@kcrisman
Copy link
Member Author

kcrisman commented Feb 4, 2015

comment:14

Hmm, that makes sense. I have to say that the error is a little cryptic.

@DaveWitteMorris
Copy link
Member

comment:15

Removing the "beginner" tag from old tickets. Some could be returned to beginner-friendly status by adding a comment about what needs to be done. Some others might be easy for an experienced developer to finish.

@mkoeppe mkoeppe removed this from the sage-6.4 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

7 participants