Home > Blockchain >  how to show an interval in logarithmic scale and other linear in matplotlib
how to show an interval in logarithmic scale and other linear in matplotlib

Time:05-16

I am using matplotlib and I want to plot a graph in which the negative part of y axis has large numbers while the positive part has smaller values and the positive part is more valuable to show. So I prefer to draw the negative part of y axis in logarithmic scale and positive part in linear(normal) scale. Here I show whole the plot with log scale and this is my code:

    plt.plot(time_stamps,objs,'-rD', markevery=markers_on )
    markers_on=  list(i for i in range(len(upper_bound)))
    plt.plot(time_stamps,upper_bound,'-bD', markevery=markers_on )
    markers_on=  list(i for i in range(len(best_P_list)))
    plt.plot(exce_time_list,best_P_list,'-gD', markevery=markers_on)
    plt.xlabel("x", fontsize=10)
    plt.ylabel("y ", fontsize=10)
    plt.yscale('symlog')
    plt.show() 

enter image description here

How can I show positive part of y axis in linear scale?

CodePudding user response:

I completely reworked my answer because I found enter image description here

  • Related