-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
Deprecate the opacity argument for plot3d and use alpha #21984
Comments
comment:1
See #25095. In the plot3d functions, the argument "alpha" is equivalent to "opacity" now. |
Dependencies: #25095 |
comment:4
If |
comment:6
I haven't checked but it sounds to me that there is a discrepancy between 2d and 3d, and also possibly a documentation issue. |
comment:7
I do not remember the original code that caused me to report this problem, but here is an example that works as expected:
and one that does not (at least in version 9.1):
Between the terms "alpha" and "opacity" I have no strong preference (both are common, e.g. opacity in CSS and alpha in RGBA). If "opacity" is now more common in Sage, then deprecating "alpha" sounds fine. The doc for that circle function still uses I just prefer consistency across the graphics function of Sage, and in particular that it will be easy to change More generally, it is a problem of not having proper tests for graphics. |
comment:8
Repurpose the ticket to "Make 'opacity' and 'alpha' |
comment:9
Replying to @slel:
Sure, sounds sensible, but I still prefer to (also) emphasize a consistent API. For example, in the EXAMPLES section across all plotting functions mainly use just one of them, say 'opacity'. What will happen if both 'opacity' and 'alpha' are given? Raising an error or ignoring one argument are the go-to options. Other options? |
Most 3d plot functions use the "opacity" keyword argument to set the transparency of the plot. On the other hand, most 2d plot functions use the "alpha" keyword argument.
It seems that the "opacity" keyword argument is also not well-documented. It sometimes appears only in the Examples sections, and not in the Input section. This is the case, at least in the following:
plot3d()
line()
circle()
parametric_plot3d()
revolution_plot3d()
Harmonizing the 2d plot and 3d plot functions would be a better UI. For example, changing a single letter of
obj.plot2d(some_args, alpha=0.5)
toobj.plot3d(some_args, alpha=0.5)
(or vice versa) should "just work", without ignoring arguments.Depends on #25095
CC: @yuan-zhou @mkoeppe @slel @jcamp0x2a @paulmasson
Component: graphics
Keywords: days79
Issue created by migration from https://trac.sagemath.org/ticket/21984
The text was updated successfully, but these errors were encountered: