Why is plot function behaving like hist function in R?

r
histogram
plot

#1

In plotting I came across a two function hist and plot but when I have used plot function on categorical data it behave likes hist function which I am not able to understand it.

z<-iris
plot(z$Species)


#2

What don’t you understand? You asked for the species and it gave you it. There are 50 of each.


#3

As species is categorical variable, plot() is like this, otherwise it would be species in y axis vs index in x axis.