Python Forum
URGENT: How to plot data from text file. Trying to recreate plots from MATLAB
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URGENT: How to plot data from text file. Trying to recreate plots from MATLAB
#5
Urgent?? There is lots of info on matplotlib around.

Here is a simple example to get you started.

import numpy
import matplotlib.pyplot as plt
# for locating minor ticks
from matplotlib.ticker import (MultipleLocator, AutoMinorLocator)

def myApp():    
    x = np.arange(0.01, 10.0, 0.01)
    y = x
    z = 2*x    
    fig, ax = plt.subplots(num='My Plot') # name of the output window
    plt.rcParams["figure.figsize"] = [5, 5] # set the size of the output window
    plt.ion() # to make plot non-blocking, i.e. if multiple plots are launched
    ax.plot(x, y, color = 'g', label='y = x')
    ax.plot(x, z, color = 'r', label='y = 2 * x')    
    ax.set_xlim(0, 10)  # increasing time
    ax.set_xlabel('increasing time (s)')
    ax.set_ylabel('voltage (mV)')
    ax.set_title('Crazy stuff ...')
    ax.grid(True)
    ax.legend()
    plt.show()
Reply


Messages In This Thread
RE: URGENT: How to plot data from text file. Trying to recreate plots from MATLAB - by Pedroski55 - Dec-03-2023, 06:56 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Fit straight line to pandas time series data with semilog plot schniefen 2 1,567 Mar-10-2023, 01:08 PM
Last Post: jefsummers
  Plot time series data schniefen 3 1,366 Mar-04-2023, 04:22 PM
Last Post: noisefloor
Exclamation Python Homework (Urgent help needed!!) chickenseizuresalad 6 4,370 Oct-11-2021, 01:59 AM
Last Post: Underscore
Exclamation urgent , Python homework alm 2 2,343 May-09-2021, 11:19 AM
Last Post: Yoriz
  urgent I got a syntax errors alm 2 5,920 Feb-28-2021, 02:54 PM
Last Post: alm
Heart Urgent homework help needed Medou 4 2,780 Nov-24-2020, 09:28 AM
Last Post: buran
  Working with text data APK 4 2,532 Aug-22-2020, 04:48 AM
Last Post: buran
  [Urgent] build code GodMaster 2 1,832 Mar-23-2020, 12:25 AM
Last Post: jefsummers
  Bifid Genkey (Urgent) Laura123 2 2,074 Mar-09-2020, 08:09 PM
Last Post: micseydel
  Read text file, process data and print specific output Happythankyoumoreplease 3 2,940 Feb-20-2020, 12:19 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020