Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Oscar Benjamin Newsgroups: comp.lang.python Subject: Re: Considering migrating to Python from Visual Basic 6 for engineering applications Date: Thu, 18 Feb 2016 10:09:55 +0000 Lines: 35 Message-ID: References: <90cc50d2-1ce5-4588-9bfd-a49d439f00dd@googlegroups.com> <14c75a68-0d2e-45cc-8d73-0d71b6a6aea6@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de uEuU3EYlMRHm7XOVWmA5SgZgWzNG8ECFvwrIVb8eA+VQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'subject:Python': 0.05; 'filename': 0.07; 'cc:addr:python-list': 0.09; '[0,': 0.09; 'jpg': 0.09; 'pyplot': 0.09; 'subject:Visual': 0.09; 'python': 0.10; 'files.': 0.13; 'subject: \n ': 0.15; '2016': 0.16; 'cc:name:python list': 0.16; 'numpy': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'python?': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'file.': 0.22; 'wrote': 0.23; 'import': 0.24; 'header:In-Reply- To:1': 0.24; 'appear': 0.26; 'message-id:@mail.gmail.com': 0.27; 'converting': 0.27; 'matplotlib': 0.29; '-----': 0.29; 'code': 0.30; 'window': 0.30; "i'd": 0.31; 'screen': 0.32; 'run': 0.33; 'received:google.com': 0.35; 'could': 0.35; 'text': 0.35; 'replaced': 0.35; 'received:209.85': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'desired': 0.37; 'pdf': 0.37; 'doing': 0.38; 'received:209': 0.38; 'skip:p 20': 0.38; 'files': 0.38; 'format': 0.39; 'subject:from': 0.39; 'easy': 0.60; 'yes': 0.62; 'sounds': 0.76; 'demand': 0.79; '3))': 0.84; 'eps': 0.84; 'matplotlib.': 0.84; 'oscar': 0.84; 'plots': 0.84; 'vb6,': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=KBnZvXdaLtJGxdn3PaCIplJyFi37I/qtGOd1QJVYzvQ=; b=D4CKqv57unxCAvx0FMkypHMUulo8kUuX3N0iFoTYFpK5isGd5klD1yXhJFScPAxyTi 6Efg72euaTNhWNPzCDFr0kDGwt2xSQUFzy6FKBCycneZuMKparsCtEOCsfUlAIf+TNJ7 Pp7KiCMxAQyHv+HvDid8j66z+Br4AONdoqWiwv2hIkUEb1GOu4WoqaYhrcWYLD/xROvK UJoOhMk7pIJInv9SIx4TFUdYa/kRC6rEVich2CyYPA6mLtVOSu+pT/i2PoJM3LidjXNZ 2lac1yXr3/nzjWjwx2PyYbyugK8gVgP7eaHqvt25Zm23Z9XaqsoJIImcZvgwLQWJv91C uP7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=KBnZvXdaLtJGxdn3PaCIplJyFi37I/qtGOd1QJVYzvQ=; b=lmN+b516Y9Wxyx1kY1xGdasobi+kG7ZUJIFU7zjMD/8VPay2ae2ySSJ/qsr5S0xx8x vVUn6Zzhq63ZOJLajEtwC/FYpInyOi3qsVFjPXWW6u6Oby1p3BDDNMknZ0f8cgBs+EZT ysTVzCE7SZ6XDj44Q+XnI0DBbD0j1GRdxsQCke7ZmX/ce11GFoBGrkPMhATdj7rPF7+A TFm0Y7eIyOYWOgGk3zl1sc44V6wpmw5LvolSRLXq86NeRsFDKKaQx8aHnhkf6ARZEF+P 6LYJgPjBAdyA2P3tPpBumvbCQDvpzSsH6zAADQJoIMhNQNZae2ygBZO2x9zr+WXNq5fu YkDA== X-Gm-Message-State: AG10YOR2cZYx+xoZIrBl4E4txVBKEOckSsJD96lU3/2zhNUgaGKnWNHxfQ0araeveTaR4XOE+tv5b/HYsSGHAg== X-Received: by 10.112.166.100 with SMTP id zf4mr2741592lbb.58.1455790215520; Thu, 18 Feb 2016 02:10:15 -0800 (PST) In-Reply-To: <14c75a68-0d2e-45cc-8d73-0d71b6a6aea6@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103101 On 18 February 2016 at 08:17, wrote: > Is it easy to create vector graphics files of plots in Python? Yes > In VB6, I wrote my own code to generate EPS files. Then people who demand jpg and gif files could be given those by converting the EPS with the desired resolution. That sounds a lot harder than doing it in Python using matplotlib. To run the following you need Python, numpy and matplotlib: ----- from matplotlib import pyplot as plt xdata = [0, 1, 2, 3, 4] ydata = [0, 1, 0, 1, 0] fig = plt.figure(figsize=(4, 3)) ax = fig.add_axes([0.15, 0.15, 0.70, 0.70]) ax.plot(xdata, ydata, color='black', linewidth=2) ax.set_xlabel('$V_x$') # Latex math-mode in text ax.set_ylabel('$V_y$') plt.show() # Make the plot window appear on screen ----- The last line can be replaced with a call to fig.savefig if you want the plot to go straight to a file. The format is inferred from the filename so: fig.savefig('plot.eps') # Do you really want eps? fig.savefig('plot.pdf') # I'd use pdf fig.savefig('plot.jpg') # etc. -- Oscar