| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I think that it may be possible to factor out if aspect == 'equal':
ax_indices = [0, 1, 2]
elif aspect == 'equalxy':
ax_indices = [0, 1]
elif aspect == 'equalxz':
ax_indices = [0, 2]
elif aspect == 'equalyz':
ax_indices = [1, 2]
and then do something like: ax_indices = _get_ax_indices(aspect)
old_diag = np.norm([box_aspect[a] for a in ax_indices]) # Maybe better way to pick out values?
new_diag = np.norm([deltas[a] for a in ax_indices]) # Same
for i in ax_indices:
box_aspect[i] = deltas[i]
remaining_index = {0, 1, 2} - set(ax_indices)
if remaining_index:
box_aspect[remining_index.pop()] = new_diag/old_diag
(I take it that numpy may have a better way to do the index fiddling.) |
Sorry, something went wrong.
|
Ahh, I didn't see the indentation level correctly. And it seems like you can get away with simpler indexing, something like: old_diag = np.norm(box_aspect[ax_indices])
new_diag = np.norm(deltas[ax_indices])
box_aspect[ax_indices] = deltas[ax_indices]
remaining_index = {0, 1, 2} - set(ax_indices)
if remaining_index:
box_aspect[remining_index.pop()] = new_diag/old_diag
|
Sorry, something went wrong.
|
Looks promising! I think a test, update of documentation (right now it says that it is ignored), a release note, and an argument check (similar to the aspect test, using _api.check_in_list) and one can review it properly. For test, I guess that reusing the same aspect test, but with adjustable='box' may be a good and easy way. |
Sorry, something went wrong.
I've got this factored out here at the moment, we can settle on whatever. |
Sorry, something went wrong.
|
Turns out that the variable was already available at that point in the code. Bad read-up on my side. |
Sorry, something went wrong.
This is brilliant; I'll rebase once it gets merged. |
Sorry, something went wrong.
I expect that MR to take a while to get reviewed and go through so don't let it hold you back on this one! :) I can handle the merge conflict over there. |
Sorry, something went wrong.
|
This is great! Looks good to me now. |
Sorry, something went wrong.
|
Doc build has failed. I think this is the error (since the log says that 'build finished with problems, 1 warning'): /home/circleci/project/doc/users/next_whats_new/font_fallback.rst:7: WARNING: Exception occurred in plotting font_fallback-1
from /home/circleci/project/doc/users/next_whats_new/font_fallback.rst:
Traceback (most recent call last):
File "/home/circleci/project/lib/matplotlib/sphinxext/plot_directive.py", line 644, in render_figures
figman.canvas.figure.savefig(img.filename(fmt), dpi=dpi)
File "/home/circleci/project/lib/matplotlib/figure.py", line 3197, in savefig
self.canvas.print_figure(fname, **kwargs)
File "/home/circleci/project/lib/matplotlib/backend_bases.py", line 2339, in print_figure
result = print_method(
File "/home/circleci/project/lib/matplotlib/backend_bases.py", line 2205, in <lambda>
print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(
File "/home/circleci/project/lib/matplotlib/_api/deprecation.py", line 410, in wrapper
return func(*inner_args, **inner_kwargs)
File "/home/circleci/project/lib/matplotlib/backends/backend_agg.py", line 520, in print_png
self._print_pil(filename_or_obj, "png", pil_kwargs, metadata)
File "/home/circleci/project/lib/matplotlib/backends/backend_agg.py", line 466, in _print_pil
FigureCanvasAgg.draw(self)
File "/home/circleci/project/lib/matplotlib/backends/backend_agg.py", line 408, in draw
self.figure.draw(self.renderer)
File "/home/circleci/project/lib/matplotlib/artist.py", line 74, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File "/home/circleci/project/lib/matplotlib/artist.py", line 51, in draw_wrapper
return draw(artist, renderer)
File "/home/circleci/project/lib/matplotlib/figure.py", line 2985, in draw
mimage._draw_list_compositing_images(
File "/home/circleci/project/lib/matplotlib/image.py", line 131, in _draw_list_compositing_images
a.draw(renderer)
File "/home/circleci/project/lib/matplotlib/artist.py", line 51, in draw_wrapper
return draw(artist, renderer)
File "/home/circleci/project/lib/matplotlib/text.py", line 688, in draw
bbox, info, descent = self._get_layout(renderer)
File "/home/circleci/project/lib/matplotlib/text.py", line 322, in _get_layout
w, h, d = _get_text_metrics_with_cache(
File "/home/circleci/project/lib/matplotlib/text.py", line 97, in _get_text_metrics_with_cache
return _get_text_metrics_with_cache_impl(
File "/home/circleci/project/lib/matplotlib/text.py", line 105, in _get_text_metrics_with_cache_impl
return renderer_ref().get_text_width_height_descent(text, fontprop, ismath)
File "/home/circleci/project/lib/matplotlib/backends/backend_agg.py", line 242, in get_text_width_height_descent
font.set_text(s, 0.0, flags=get_hinting_flag())
File "/home/circleci/project/lib/matplotlib/_text_helpers.py", line 16, in warn_on_missing_glyph
_api.warn_external(
File "/home/circleci/project/lib/matplotlib/_api/__init__.py", line 363, in warn_external
warnings.warn(message, category, stacklevel)
UserWarning: Glyph 20960 (\N{CJK UNIFIED IDEOGRAPH-51E0}) missing from current font.
which isn't quite clear to me. I don't suppose modifying 3d_plot_aspects.rst caused this somehow? |
Sorry, something went wrong.
|
The docs font fallback issue is unrelated to your PR, try rebasing onto main and seeing if it works when it runs again. |
Sorry, something went wrong.
|
It looks like this didn't get reviewed in time to make the cut for 3.6, which won't have an effect except that the what's new might need to be rewritten. |
Sorry, something went wrong.
|
How does it work—will it be enough to just create a new "What's New" file? |
Sorry, something went wrong.
|
Actually, no changes are required for the what's new. The content and structure is version agnostic. When the PR gets merged the content is put int the next_whats_new folder on the main branch, and that will be picked up in the next release. @oscargus you have started looking into this. Could you give a second review? |
Sorry, something went wrong.
|
Considering that this PR modifies a what's new note from 3.6, I believe that something should be done. I think the PR is good to go, subject to the what's new note, so will not merge at this stage. |
Sorry, something went wrong.
|
Could you also take a look at #23552 (comment). |
Sorry, something went wrong.
|
For the "What's New" entry, I used scottshambaugh's original example, but with slightly different dimensions of the box (as in the test), which I think highlight the differences nicely. |
Sorry, something went wrong.
|
Looks good! Thanks! |
Sorry, something went wrong.
…b#23552) * Provided `adjustable='box'` option to set 3D aspect ratio. * "What's New": `adjustable` argument of 3D plots aspect ratio.
…b#23552) * Provided `adjustable='box'` option to set 3D aspect ratio. * "What's New": `adjustable` argument of 3D plots aspect ratio.
…b#23552) * Provided `adjustable='box'` option to set 3D aspect ratio. * "What's New": `adjustable` argument of 3D plots aspect ratio.
| Back | FazBrowse Home | New Git URL |
PR Summary
#23409 implemented equal aspect for 3D axes similar to the wayaxes2d.set_aspect('equal', adjustable='datalim') works. This adds functionality similar to the way axes2d.set_aspect('equal', adjustable='box') works (i.e. without changing the limits on the axes of coordinates).
The code is probably not the cleanest; style suggestions are appreciated.
PR Checklist
Tests and Styling
Documentation