WpfPlot ignores layout padding if defined during window initialization
See original GitHub issueDescribe the bug Rendering a WPF plot includes an unnecessary and undesirable margin that cannot be removed (or at least I couldn’t find a way to remove it).
To Reproduce To reproduce the problem, create a WPF project and add a window with a single WpfPlot element like this:
<Window>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<WpfPlot x:Name="testWpfPlot" Padding="0"/>
</Grid>
</Window>
Then, configure the plot to render some signal or any plottable and then remove the ticks and attempt to change layout to remove any additional padding or extra space around the figure.
testWpfPlot.plt.Clear(scatterPlots: true);
testWpfPlot.plt.PlotBar(xs: new double[100], ys: new double[100], // can generate some random data and plot
barWidth: 2,
xOffset: -0.5,
fillColor: System.Drawing.Color.SlateGray,
outlineWidth: 0,
label: "test");
testWpfPlot.plt.Grid(xSpacing: 2);
testWpfPlot.plt.Style(ScottPlot.Style.Gray2);
testWpfPlot.plt.AxisAuto();
testWpfPlot.plt.Ticks(displayTickLabelsX: false, displayTickLabelsY: false, displayTicksX: false, displayTicksY: false);
testWpfPlot.plt.TightenLayout(padding: 0);
testWpfPlot.plt.Frame(false);
The expectation is that the plot would render using the full available space without leaving any additional space
Screenshots
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
WpfPlot ignores layout padding if defined during window ...
It looks like in order to preserve the "no padding" setting I needed to call TightenLayout(padding: 0) before the Render call each time....
Read more >wpf - Window.Margin & Window.Padding don't work
I have a whole project that all its windows are set to a style, I want to set this properties (or other) in...
Read more >ScottPlot 4.0.47 Cookbook
The strategy is to plot it on a linear horizontal axis (not a DateTime axis) and then to come back later and define...
Read more >Alignment, Margins, and Padding Overview - WPF .NET ...
This topic discusses four of the most important properties: HorizontalAlignment, Margin, Padding, and VerticalAlignment. The effects of these ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sopgenorth you may also find use in your plot’s
Frameless()
methodhttps://scottplot.net/cookbook/4.1/category/axis-and-ticks/#frameless-plots
Hi @sopgenorth
Indeed! Try calling your plot’s
Layout()
method. Pay close attention to each of the arguments, includingpadding
.I created issue #1841 with the goal of adding a cookbook section to make these features easier to discover 👍