0

I am preparing a paper to submit to a journal. In the Author's guidelines, they said that the format of the images is (among other things) 3:2 (proportion width and height). I am doing graphics using matplotlib, and I want to get a .eps format images with this proportion (3:2) to put them in a latex file, but ensuring that feature. I just want to know if I am doing it right.

import numpy as np 
import matplotlib.pyplot as plt 
from random import randint, uniform,random
import random
import math

plt.rcParams['font.family'] = "Times New Roman" #Fount size.
plt.rcParams["figure.figsize"] = (30,20)        #width and height prportion

variables=[1563,6004,26406,52631,95580,183615,480500,1030582]
restricciones=[3538,15459,68886,155116,285660,603255,1709703,3694572]
instancias=['$I_{1}$','$I_{2}$','$I_{3}$','$I_{4}$','$I_{5}$','$I_{6}$','$I_{7}$','$I_{8}$']
plt.plot(instancias,variables,'#828282',marker='o',label="Number of decision variables")
plt.plot(instancias,restricciones,'#1E1E1E',marker='^',label="Number of constraints")
plt.grid()
plt.xlabel("Instances")
plt.ylabel("Units generated")
plt.legend(loc=0)
plt.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
plt.savefig("test.eps",dpi=1200)
plt.show()

using plt.rcParams["figure.figsize"] = (30,20) , ensure that this proportion (30:20=3:2=1.5) it will be satisfied when I used the .eps file generated in the latex document? Thanks in advance

1 Answers1

0

changing aspect of figure:

fig = plt.figure(figsize=(1,2))
plt.scatter(range(5), range(5))

enter image description here

fig = plt.figure(figsize=(2,2))
plt.scatter(range(5), range(5))

enter image description here

fig = plt.figure(figsize=(2,1))
plt.scatter(range(5), range(5))

enter image description here

changing aspect of subplots

set_aspect is your friend:

plt.scatter(range(5), range(5))
plt.gca().set_aspect(.1)

enter image description here

plt.scatter(range(5), range(5))
plt.gca().set_aspect(1)

enter image description here

plt.scatter(range(5), range(5))
plt.gca().set_aspect(10)

enter image description here

warped
  • 8,947
  • 3
  • 22
  • 49