matplotplusplus icon indicating copy to clipboard operation
matplotplusplus copied to clipboard

xticklabels doesn't change ticks bar

Open TheGreatRambler opened this issue 2 years ago • 3 comments

Bug category

  • [ ] bug - compilation error
  • [ ] bug - compilation warning
  • [x] bug - runtime error
  • [ ] bug - runtime warning
  • [ ] bug - logic error

Describe the bug Using xticklabels doesn't render ticks when using the bar chart as seen in example bar_7.cpp.

Steps to Reproduce

	figure = matplot::figure<matplot::backend::gnuplot> (true);
	figure->ioff ();
	auto ax = figure->current_axes ();
	ax->ytickformat ("%.0f");
	ax->bar (counts);
	ax->xticklabels (names);
	ax->x_grid (true);
	ax->xtickangle (45);
        figure->save (path, "png");

Output

# The output you got

Platform

  • [ ] cross-platform issue - linux
  • [x] cross-platform issue - windows
  • [ ] cross-platform issue - macos

Environment Details:

  • OS: Windows 10
  • OS Version: 21H2
  • Compiler: MinGW64 GCC
  • Compiler version: 11.2.0

Additional context

TheGreatRambler avatar Apr 27 '22 08:04 TheGreatRambler

Maybe we could modify the xticklabels example until we replicate the bug. It might be ordering of the commands or something.

alandefreitas avatar Apr 27 '22 13:04 alandefreitas

I've isolated the issue. Labels will be shown if there are 15 or less. Any more and they silently fail

TheGreatRambler avatar Jun 02 '22 04:06 TheGreatRambler

https://github.com/alandefreitas/matplotplusplus/blob/master/source/matplot/axes_objects/bars.cpp#L24 seems like a possible reason for this

TheGreatRambler avatar Jun 02 '22 04:06 TheGreatRambler