Skip to content

Commit

Permalink
Merge pull request #13 from iansteeg/savefig
Browse files Browse the repository at this point in the history
argument to save figure added
  • Loading branch information
henriasv authored Dec 16, 2024
2 parents 1c59e43 + 158e719 commit bddedba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lammps_logfile/cmd_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def get_parser():
parser.add_argument("-x", type=str, default="Time", help="Data to plot on the first axis")
parser.add_argument("-y", type=str, nargs="+", help="Data to plot on the second axis. You can supply several names to get several plot lines in the same figure.")
parser.add_argument("-a", "--running_average", type=int, default=1, help="Optionally average over this many log entries with a running average. Some thermo properties fluctuate wildly, and often we are interested in te running average of properties like temperature and pressure.")
parser.add_argument("-o", type=str, dest='fout', default='', help='Save the figure to this file; the format must be supported by matplotlib.')
parser.add_argument("input_file", metavar='INPUT_FILE', type=str, help="Lammps log file containing thermo output from lammps simulation.")
return parser

Expand All @@ -27,4 +28,6 @@ def run():
plt.plot(x, data, label=y)
plt.legend()
plt.show()

if args.fout != '':
plt.savefig(args.fout, dpi=300)

0 comments on commit bddedba

Please sign in to comment.