Skip to content
Snippets Groups Projects
Commit 20a27bc2 authored by Lan Dam's avatar Lan Dam
Browse files

solving plot is pushed to left after the first plot

parent f1731559
No related branches found
No related tags found
1 merge request!270solving plot is pushed to left after the first plot
......@@ -241,10 +241,9 @@ class PlottingWidget(QtWidgets.QScrollArea):
view_port_size = self.maximumViewportSize()
view_port_width = view_port_size.width()
self.plotting_axes.canvas.setFixedWidth(view_port_width)
fig_width_in = view_port_width/self.parent.dpi_x
self.fig_width_in = view_port_width/self.parent.dpi_x
self.plotting_axes.fig.set_dpi(self.parent.actual_dpi)
self.plotting_axes.fig.set_figwidth(fig_width_in)
# set view size fit with the scroll's viewport size
self.main_widget.setFixedWidth(view_port_size.width())
......@@ -272,6 +271,13 @@ class PlottingWidget(QtWidgets.QScrollArea):
max_height = max(self.maximumViewportSize().height(), fig_height)
self.main_widget.setFixedHeight(max_height)
self.plotting_axes.canvas.setFixedHeight(max_height)
# If figure width is set before canvas height is set, it will be
# changed once canvas height is set for the first plotting. But in the
# second plotting, that problem won't happen so the figure width remain
# the same as what is set. As the result the figure width will be
# different between the first plotting and the rest.
# To avoid that figure's width has to be set after canvas' height.
self.plotting_axes.fig.set_figwidth(self.fig_width_in)
# calculate height_normalizing_factor which is the ratio to multiply
# with height ratio of an item to fit in figure height start from
# 1 to 0.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment