0

I'm trying to create a plot about crimes in my city per 100000 inhabitants (the plot 1 above), x-axis is the year of the crime and y-axis the crime per 100000 inhabitants. I've a problem with x-axis because it repeat the years. How can i avoid it? I want to each year only show up a time.

Crimenes

Code:

data = xlsread('Pico.xls');
x  = [2012 2013 2014 2015 2016];
plot( x,data(2,:),'-C',x, data(3,:),'-V',x, data(4,:),'-V',x, data(5,:),'-V')
xtickformat('%i')
SergioSalinas
  • 115
  • 1
  • 2
  • 11

1 Answers1

0

You want the x-axis ticks equal to the values in your x variable. To achieve that, add this after your code:

set(gca, 'xtick', x)
Luis Mendo
  • 110,752
  • 13
  • 76
  • 147