-1
The graph became small and poorly positioned.
for i in df.index:
plt.plot(df.at[i,'x0'], df.at[i,'y0'], label=i)
# A e B
plt.axvline(x=ABx, ymin=0.1, ymax=0.55, linestyle = "dashed", color='gray')
plt.scatter(ABx,ABy, marker= 'o', color='black', s=20, alpha = 0.8)
plt.annotate('Ponto Crítico da Produção A e B (' + str(ABx) + ', ' + str(ABy) + ')', (ABx,ABy),
textcoords="offset points", # how to position the text
xytext=(20,0), # distance from text to points (x,y)
ha='left' # horizontal alignment can be left, right or center
)
# B e C
plt.axvline(x=BCx, ymin=0.1, ymax=0.4, linestyle = "dashed", color='gray')
plt.scatter(BCx,BCy, marker= 'o', color='black', s=20, alpha = 0.8)
plt.annotate('Ponto Crítico da Produção B e C (' + str(BCx) + ', ' + str(BCy) + ')', (BCx,BCy),
textcoords="offset points", # how to position the text
xytext=(20,0), # distance from text to points (x,y)
ha='left' # horizontal alignment can be left, right or center
)
x0, y0, r = 0, 0, ABx # dados do círculo
t = np.arange(0, 2*np.pi, 0.01) # dominio da função (passo 0.01 para melhorar a precisão)
x = x0 + r * np.cos(t) # calculando X e Y
y = y0 + r * np.sin(t)
plt.plot(x, y, 'r-', linestyle = "dashed")
x0, y0, r = 0, 0, BCx # dados do círculo
t = np.arange(0, 2*np.pi, 0.01) # dominio da função (passo 0.01 para melhorar a precisão)
x = x0 + r * np.cos(t) # calculando X e Y
y = y0 + r * np.sin(t)
plt.plot(x, y, 'r-', color='green', linestyle = "dashed")
plt.title('Von Thunen')
plt.legend()
plt.ylabel('LUCRO LÍQUIDO')
plt.xlabel('DISTÂNCIA')
plt.axvline(x=0, ymin=0, ymax=1, linestyle = "solid", color='black')
plt.axhline(y=0, xmin=0.4, xmax=1, linestyle = "solid", color='black')
#plt.box(False)
plt.axis('equal')
#plt.axis([0, 40, 0, 70]) # [xmin, xmax, ymin, ymax]
plt.show()
It would help to have a portion or all of the dataset to replicate exactly
– Miguel
True, it’s my fault. The notebook is here: https://colab.research.google.com/drive/1xRPYWXjlq0DhQ1zRckhXrk0lGxAr0pI?usp=sharing and csv with the following data: https://drive.google.com/file/1GGbVw11izHDpUfPZD64BERGianb0w37/view?usp=sharing
– Emmanuel Ferro
I’m sorry, the csv you shared does not contain the columns the code accesses, e.g.:
x0
. To help you better I would have to replicate exactly the graph and the problem you have.– Miguel
I don’t get it, but if that part is in the code it puts that part in the question too
– Miguel
Sorry, I should have made it easier from the beginning, I thought sharing the laptop would be easier. I add two columns X0 and Y0 to the Data Frame so:
df['y0'] = list(zip(df.LB, df.CT*0))
df['x0'] = list(zip(df.LB*0, df.LB/df.CT))
– Emmanuel Ferro
Puts
plt.figure(figsize=(15,8))
before the cycle goes and see if it solves the problem sff.– Miguel
The size was excellent, but the chart is centered on the source (0.0) and I wanted to shift it all to the left because there is too much empty space left.
– Emmanuel Ferro