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

Setting xmin and xmax for hlines in data coordinates #4443

Open
musoke opened this issue Oct 2, 2024 · 3 comments
Open

Setting xmin and xmax for hlines in data coordinates #4443

musoke opened this issue Oct 2, 2024 · 3 comments
Labels
enhancement Feature requests and enhancements Makie Backend independent issues (Makie core) plot Related to plot object

Comments

@musoke
Copy link
Contributor

musoke commented Oct 2, 2024

Feature description

For clarity, I refer only to hlines in this feature request. Assume that the following applies to ymin and ymax for vlines too.

I would like to be able to set minimum and maximum x-values for hlines in data coordinates. As far as I can tell, it is currently only possible to set these in scene coordinates.

In this code, I attempt to draw horizontal lines that extend right from a curve by using xmin in scene coordinates.

using CairoMakie
lines(0..10, sqrt)
hvals = [1, 2, 3]
hlines!(hvals, xmin=hvals.^2 ./ 10)
current_figure()

image

As you can see, the naive conversion to scene coordinates is buggy because the scene's limits do not correspond exactly to the data's limits. In more complex plots, converting coordinates manually can be even harder.

Alternatively, being able to use lines without affecting the limits would allow a similar result.

@musoke musoke added the enhancement Feature requests and enhancements label Oct 2, 2024
@musoke
Copy link
Contributor Author

musoke commented Oct 2, 2024

matplotlib implements these as separate plot types: hlines and axhlines.

@jkrumbiegel
Copy link
Member

You could use rangebars for that with horizontal orientation

@musoke
Copy link
Contributor Author

musoke commented Oct 3, 2024 via email

@ffreyer ffreyer added Makie Backend independent issues (Makie core) plot Related to plot object labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and enhancements Makie Backend independent issues (Makie core) plot Related to plot object
Projects
None yet
Development

No branches or pull requests

3 participants