1
$\begingroup$
Module[{labels = {"1990", "1991", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 
"2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", 
"2012", "2013", "2014", "2015", "2016"}, 
data = {1, 0, 0, 0, 2, 1, 0, 7, 12, 2, 1, 0, 2, 2, 2, 1, 1, 2, 4, 2,
 4, 2, 2, 2, 2, 1, 1}}, 
BarChart[data, 
ChartLabels -> 
Placed[Sort[
Style[#, FontSize -> Scaled[.016]] & /@ labels], {{0.5, 0}, {0.9,
   1}}, Rotate[#, 50 Degree, {Right, Center}] &], 
PlotRange -> {Automatic, {0, 13}}, 
ImagePadding -> {{40, 10}, {95, 10}}, 
Frame -> {{True, True}, {True, True}}, 
FrameLabel -> {Style["", FontSize -> 5], 
Style["nº de publicaciones", FontSize -> 13]}, 
FrameTicks -> {{True, None}, {None, None}}]]

I would like to know how can the labels with '0' data be shown. With this code I don't get any label for 1991,1992,... and all other year with '0' data

Thanks in advanced

$\endgroup$
  • $\begingroup$ I've used '0.0001' instead of 0 and the labels are shown.. But I would like to know if there is a 'better' way to do it $\endgroup$ – user25578 Nov 18 '16 at 17:14
  • $\begingroup$ Based on your other question, try enclosing {{0.5, 0}, {0.9, 1}} in another set of brackets: {{{0.5, 0}, {0.9, 1}}}. It would be useful to write in the OP the version you use, as again your code works fine for me under 10.4.1. $\endgroup$ – corey979 Nov 18 '16 at 17:16
  • $\begingroup$ Works fine with version 11.0.1 for Mac OS X x86 (64-bit) $\endgroup$ – Bob Hanlon Nov 18 '16 at 17:18
  • $\begingroup$ I use version 9 for Linux 64-bit $\endgroup$ – user25578 Nov 18 '16 at 17:25
  • $\begingroup$ Related Q/A: Setting ChartLabels in a histogram $\endgroup$ – kglr Nov 18 '16 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.