1

how can i solve this problem

I could not find the solution to fix this confusion. My data is lost when I scale it. When I give minimum and maximum values, the confusion continues again.

def ohlcPlot(data,name):
    for i in range(len(data)):
        plt.vlines(x = i,ymin = data.iloc[i,2],ymax = data.iloc[i,1],color = "black",linewidth = 1)
        if(data.iloc[i,3] > data.iloc[i,0]):
            plt.vlines(x = i,ymin=data.iloc[i,0],ymax=data.iloc[i,3],color="green",linewidth=4)
        if(data.iloc[i,3] < data.iloc[i,0]):
            plt.vlines(x=i,ymin=data.iloc[i,3],ymax=data.iloc[i,0],color="red",linewidth=4)
        if(data.iloc[i,3] == data.iloc[i,0]):
            plt.vlines(x=i,ymin=data.iloc[i,3],ymax=data.iloc[i,0],color="black",linewidth=4)
    plt.figure(figsize=plt.figaspect(0.4)) #en-boy oran: 0.4
    plt.grid()
    plt.title(name)
  • 1
    Could you provide the code you used to generate this plot? I have a good guess to what's causing this, but I could help you better if I saw your work. – K.Cl Apr 15 '21 at 22:56
  • I added my codes. I am trying to produce a candlestick chart this way. I guess I'm having a problem on the y-axis because it is in a loop. I could not find a way to solve this. – Emirhan KARADENİZ Apr 16 '21 at 14:56
  • Sorry, but I still can't properly debug your problem. I have two theories. 1. The y data you're plotting is categorical, and you have to transform it into numeric (check that your dataframe's `dtype` is `float64` or something like that). Or 2, more likely, you supplied some command to specify the `yticks`, and passed a list/array with a lot of values. You're supposed only to pass values where the ticks are supposed to appear, like `[0.103, 0.104, 0.105]`, etc. – K.Cl Apr 16 '21 at 18:40
  • I assisted someone recently with a similar problem to yours. Check it here: https://stackoverflow.com/questions/67075046/arrange-values-and-labels-on-plots-yticks-xticks/67076525?noredirect=1#comment118564740_67076525 – K.Cl Apr 16 '21 at 18:40

0 Answers0