You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I spotted the following bug in version 5.2.7, which I report for clarity (as I found a fix)
This code works properly: import plotext as plt; plt.main().clf(); plt.plot([1,2]); plt.frame(0); plt.subplots(2,2); plt.show();.
The 4 subplots inherit both the plot data and the instruction of removing the frame.
Analogously this code works fine: import plotext as plt; plt.main().clf(); plt.subplots(2,2); plt.plot([1,2]); plt.main().frame(0); plt.show();
The 4 subplots do not have initial data or instrucion before being created, but the information is passed later to the global figure (and so to all its subplots) and all goes well.
This code however does not work: import plotext as plt; plt.main().clf(); plt.subplots(2,2); plt.subplot(1,1).plot([1,2]); plt.subplot(1,1).frame(0); plt.subplot(1,1).subplots(2,2); plt.show();
The situation is the same as in the first case, the difference is that there are nested subplots and in this case the inheritance does not work.
Interestingly passing the data or instructions to nested subplots, after being created works as in code 2: import plotext as plt; plt.main().clf(); plt.subplots(2,2); plt.subplot(1,1).subplots(2,2); plt.subplot(1,1).plot([1,2]); plt.subplot(1,1).frame(0); plt.show();
The issue is due to the fact that the subplots, when build, think their parent is their grand-parent (due to an error in the script). All works fine with one level subplots because grand-parent = parent here; for nested subplots instead grand-parent = main figure and not the actual parent, messing up inheritance.
Issue solved anyway in [new commit] i.e. version 5.2.8 (only on GitHub for now) (57407ad).
The text was updated successfully, but these errors were encountered:
piccolomo
changed the title
Subplots do not Inherit Parent properly
Subplots do not Inherit from Parent Figure Properly
Oct 26, 2022
I spotted the following bug in version 5.2.7, which I report for clarity (as I found a fix)
This code works properly:
import plotext as plt; plt.main().clf(); plt.plot([1,2]); plt.frame(0); plt.subplots(2,2); plt.show();
.The 4 subplots inherit both the plot data and the instruction of removing the frame.
Analogously this code works fine:
import plotext as plt; plt.main().clf(); plt.subplots(2,2); plt.plot([1,2]); plt.main().frame(0); plt.show();
The 4 subplots do not have initial data or instrucion before being created, but the information is passed later to the global figure (and so to all its subplots) and all goes well.
This code however does not work:
import plotext as plt; plt.main().clf(); plt.subplots(2,2); plt.subplot(1,1).plot([1,2]); plt.subplot(1,1).frame(0); plt.subplot(1,1).subplots(2,2); plt.show();
The situation is the same as in the first case, the difference is that there are nested subplots and in this case the inheritance does not work.
Interestingly passing the data or instructions to nested subplots, after being created works as in code 2:
import plotext as plt; plt.main().clf(); plt.subplots(2,2); plt.subplot(1,1).subplots(2,2); plt.subplot(1,1).plot([1,2]); plt.subplot(1,1).frame(0); plt.show();
The issue is due to the fact that the subplots, when build, think their parent is their grand-parent (due to an error in the script). All works fine with one level subplots because grand-parent = parent here; for nested subplots instead grand-parent = main figure and not the actual parent, messing up inheritance.
Issue solved anyway in [new commit] i.e. version 5.2.8 (only on GitHub for now) (57407ad).
The text was updated successfully, but these errors were encountered: