Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

What is research but a blind date with knowledge? -- Will Harvey


devel / comp.lang.python / RE: Trying to read from a text file to generate a graph

SubjectAuthor
o RE: Trying to read from a text file to generate a graphSteve

1
RE: Trying to read from a text file to generate a graph

<mailman.283.1627546278.4164.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18756&group=comp.lang.python#18756

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: Gronicus@SGA.Ninja (Steve)
Newsgroups: comp.lang.python
Subject: RE: Trying to read from a text file to generate a graph
Date: Thu, 29 Jul 2021 04:11:06 -0400
Lines: 83
Message-ID: <mailman.283.1627546278.4164.python-list@python.org>
References: <014701d7837d$96643820$c32ca860$@SGA.Ninja>
<YQEUbsro2JdIs1kD@cskk.homeip.net>
<018f01d783c9$648fa680$2daef380$@SGA.Ninja> <87k0larsqw.fsf@rub.de>
<021d01d78451$48bcf740$da36e5c0$@SGA.Ninja>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 744lZS77PCMMjFTvXbmz2AGLleiyueECgupwLYKbkRcA==
Return-Path: <Gronicus@SGA.Ninja>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=sga.ninja header.i=@sga.ninja header.b=Jhz2QyWQ;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.041
X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'jul': 0.04; 'url:mailman':
0.09; 'footnote:': 0.09; 'graph': 0.09; 'numerical': 0.09;
'responses': 0.09; 'subject:Trying': 0.09; 'url:stable': 0.09;
'values.': 0.09; 'problem': 0.15; 'assignments': 0.16; 'bugs':
0.16; 'complete.': 0.16; 'from:addr:gronicus': 0.16;
'from:addr:sga.ninja': 0.16; 'from:name:steve': 0.16; 'graphs':
0.16; 'labels': 0.16; 'message-id:@SGA.Ninja': 0.16;
'received:floathosting.com': 0.16;
'received:mars.floathosting.com': 0.16; 'sensors,': 0.16;
'strings,': 0.16; 'wrote:': 0.16; 'url:listinfo': 0.16; 'values':
0.16; 'wednesday,': 0.18; 'code.': 0.19; 'generated': 0.20; 'url-
ip:188.166.95.178/32': 0.20; 'url-ip:188.166.95/24': 0.20; 'url-
ip:188.166/16': 0.23; 'subject:file': 0.23; 'to:addr:python-list':
0.23; 'run': 0.24; 'code': 0.24; 'section': 0.26; 'skip:- 10':
0.26; 'elements': 0.27; 'creating': 0.27; 'url-ip:188/8': 0.29;
'text': 0.29; 'code,': 0.31; 'but': 0.31; 'program,': 0.31;
'good.': 0.32; 'half': 0.32; 'python-list': 0.32; 'stephen': 0.32;
'program': 0.33; 'using': 0.33; 'header:In-Reply-To:1': 0.33;
'subject:from': 0.35; 'following': 0.35; 'bar': 0.35; 'trying':
0.36; 'lists': 0.37; 'file': 0.38; 'read': 0.38; 'though': 0.38;
'going': 0.38; 'to:2**1': 0.38; 'does': 0.38; 'list': 0.39;
'skip:e 10': 0.60; 'here': 0.62; 'to:': 0.62; 'choose': 0.62;
'down': 0.62; 'website.': 0.62; 'url-ip:172.67/16': 0.64; 'pass':
0.64; 'url:index': 0.64; 'your': 0.64; 'extremely': 0.65; 'only,':
0.65; 're:': 0.65; 'july': 0.66; 'number:': 0.66; 'look': 0.66;
'skip:t 20': 0.67; 'skip:o 20': 0.67; 'site': 0.69; 'cast': 0.69;
'subject:read': 0.69; 'shows': 0.70; 'sent:': 0.71; 'selecting':
0.77; 'url-ip:104.26/16': 0.79; 'out.': 0.80; '2021': 0.84;
'forgot': 0.84; 'sensors': 0.84; 'struggle': 0.84; 'demo': 0.91;
'url-ip:104.26.0/24': 0.91; 'url-ip:104.26.1/24': 0.91; 'url-
ip:172.67.74/24': 0.91
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sga.ninja;
s=default;
h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:
Date:Subject:In-Reply-To:References:To:From:Sender:Reply-To:Cc:Content-ID:
Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
List-Post:List-Owner:List-Archive;
bh=hwA8dfWOIHNEjCmC+AVMXfdPx/iAGcFDYczls6X0hxc=; b=Jhz2QyWQr1tAUbrUqiwz0NZnGF
GvRjXO4Y1mt2ON/tQPRt/y14lJVw/MYC+vf4XOmVompwlGQu83cz8gcq8gVN9S5Nx6R/E49jXLe38
mL+uu+XhvM968iLw+aWNdJ6349iZdzhB+XDNuN8FEOYIJdTOnBxcOh4Xu3+I7P1QZveo8o1ueWzkH
9ayv34OmfvvASBBdOWigOo7bpEBmUnAyxOBXz94Xdp9NabzR842AHr1de53Mwcj5nO1UGh1VVFIBE
8yOfiTU3jBtNuGZ3FD5xkITbc7wKRhS43dyr7EEG5rQsp32ptcFEyUJiJF+cFXMEIaa9SPe5TFH3c
UEg9dCSg==;
In-Reply-To: <87k0larsqw.fsf@rub.de>
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQIP6HBidjgv9u8kRMmSj6PYtsFCfAI4KWhYAqlnp4QBfAf+RKq15HYw
Content-Language: en-us
X-AntiAbuse: This header was added to track abuse,
please include it with any abuse report
X-AntiAbuse: Primary Hostname - mars.floathosting.com
X-AntiAbuse: Original Domain - python.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - SGA.Ninja
X-Get-Message-Sender-Via: mars.floathosting.com: authenticated_id:
gronicus@sga.ninja
X-Authenticated-Sender: mars.floathosting.com: gronicus@sga.ninja
X-Source:
X-Source-Args:
X-Source-Dir:
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <021d01d78451$48bcf740$da36e5c0$@SGA.Ninja>
X-Mailman-Original-References: <014701d7837d$96643820$c32ca860$@SGA.Ninja>
<YQEUbsro2JdIs1kD@cskk.homeip.net>
<018f01d783c9$648fa680$2daef380$@SGA.Ninja> <87k0larsqw.fsf@rub.de>
 by: Steve - Thu, 29 Jul 2021 08:11 UTC

Thank you, the responses here have been extremely helpful.
Steve

----------------------------------------------------------------------------
----------------
Footnote:
There's 99 bugs in the code, in the code.
99 bugs in the code.
Take one down and patch it all around.
Now there's 117 bugs in the code.

-----Original Message-----
From: Python-list <python-list-bounces+gronicus=sga.ninja@python.org> On
Behalf Of Stephen Berman
Sent: Wednesday, July 28, 2021 5:36 PM
To: python-list@python.org
Subject: Re: Trying to read from a text file to generate a graph

[Resending to the list only, since I couldn't post it without subscribing.]

On Wed, 28 Jul 2021 11:58:21 -0400 "Steve" <Gronicus@SGA.Ninja> wrote:

> I forgot about the no-file rule...
>
>> On 28Jul2021 02:55, Steve <Gronicus@SGA.Ninja> wrote:
>> I am going though a struggle with this and just don't see where it
>> fails. I am using the Dual Bar Graph.py program from
>> https://matplotlib.org/stable/gallery/index.html website. The file
>> from the web site works so that shows that all my installations are
>> complete.
>>
>> My program, LibreGraphics 05.py program runs but the graph is all
>> smutched up. I am pulling data from the EXCEL-FILE.txt into the
>> program, selecting three values for each line and creating three
>> variables formatted as is shown in the original demo file.
>>
>> When you run the program, choose 112 when prompted. You will see the
>> values of the variables I want to pass to the graph section of the
>> code. If the values are hardcoded, the graphs look good. When the
>> variables generated by my section of the code, it does not.

The problem is due to the values of Sensors, TestStrips and SampleNumber
being strings; what you want is for them to be lists, as in the assignments
you commented out. And since the data from the file is read in as strings,
you have to cast the elements of the Sensors and TestStrips lists to
integers, since you want the numerical values. The following code does the
job:

Sensors = []
TestStrips = []
SampleNumber = []

x = 1
SensorNumber = input("Enter senaor number: ")
with open("_EXCEL-FILE.txt", 'r') as infile:
for lineEQN in infile:
if (lineEQN[0:1]== "."):
SN = lineEQN[44:48].strip()
if (SensorNumber == SN):
SN = x
SampleNumber.append(SN)

sv = lineEQN[25:29].strip()
Sensors.append(int(sv))

tv = lineEQN[32:37].strip()
TestStrips.append(int(tv))

x += 1

labels = SampleNumber

Add the rest of your code from the second half to make the desired bar
chart.

Steve Berman
--
https://mail.python.org/mailman/listinfo/python-list


devel / comp.lang.python / RE: Trying to read from a text file to generate a graph

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor