Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Baby On Board.


devel / comp.lang.python / RE: matplotlib questions

SubjectAuthor
o RE: matplotlib questionsSteve

1
RE: matplotlib questions

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: Groni...@SGA.Ninja (Steve)
Newsgroups: comp.lang.python
Subject: RE: matplotlib questions
Date: Fri, 27 Aug 2021 23:39:05 -0400
Lines: 144
Message-ID: <mailman.479.1630121955.4164.python-list@python.org>
References: <000801d79a91$b4d851d0$1e88f570$@SGA.Ninja>
<YSk8GdaBpuz6JIjb@icerm-dld>
<005c01d79bbe$410754d0$c315fe70$@SGA.Ninja>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de vn3DZd4ZYfAnL8h4TkxM3gWfg2ThhzY6MiV4XyoOxdwA==
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=Dk5d5xEM;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '17,': 0.03; 'jul': 0.04;
'31,': 0.05; '26,': 0.07; 'mar': 0.07; 'matplotlib': 0.07;
'url:mailman': 0.09; '18,': 0.09; '27,': 0.09; 'aug': 0.09;
'dates.': 0.09; 'graph': 0.09; 'mon': 0.09; 'numpy': 0.09; 'ok,':
0.09; 'skip:_ 20': 0.09; 'url-ip:152/8': 0.09; 'url:stable': 0.09;
'looks': 0.11; 'import': 0.14; '02,': 0.16; 'fri': 0.16;
'from:addr:gronicus': 0.16; 'from:addr:sga.ninja': 0.16;
'from:name:steve': 0.16; 'labels': 0.16; 'message-id:@SGA.Ninja':
0.16; 'properly.': 0.16; 'received:floathosting.com': 0.16;
'received:mars.floathosting.com': 0.16; 'sorted': 0.16;
'subject:matplotlib': 0.16; 'subject:questions': 0.16; 'thu':
0.16; 'tue': 0.16; 'url-ip:152.19.134.41/32': 0.16; 'url-
ip:152.19.134/24': 0.16; 'url-ip:152.19/16': 0.16; 'width,': 0.16;
'url:listinfo': 0.16; 'feb': 0.18; 'modify': 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; '16,': 0.23; 'to:addr:python-list': 0.23;
'code': 0.24; 'skip:p 30': 0.26; 'skip:- 10': 0.26; '11,': 0.27;
"i'll": 0.28; 'url-ip:188/8': 0.29; 'text': 0.29; 'code,': 0.31;
'suggestions': 0.31; 'but': 0.31; '(with': 0.31; '113': 0.32;
'115': 0.32; '118': 0.32; '13,': 0.32; '23,': 0.32; 'do.': 0.32;
'friday,': 0.32; 'python-list': 0.32; 'skip:= 30': 0.32; 'header
:In-Reply-To:1': 0.33; '100': 0.34; '22,': 0.35; 'bar': 0.35;
'code:': 0.35; 'trying': 0.36; 'count': 0.37; 'change': 0.37;
'to:2**1': 0.38; 'use': 0.38; 'list': 0.39; 'called': 0.40;
'simple': 0.40; 'days': 0.61; '10,': 0.61; 'here': 0.62; 'to:':
0.62; '25,': 0.63; 'showing': 0.63; 'url-ip:172.67/16': 0.64;
'url:index': 0.64; 're:': 0.65; 'skip:o 20': 0.67; 'margin': 0.69;
'indicated': 0.71; 'sent:': 0.71; 'skip:f 20': 0.76; 'url-
ip:104.26/16': 0.79; '2021': 0.84; 'axis': 0.84; 'bars': 0.84;
'bottle': 0.84; 'experiment': 0.84; 'indicates': 0.84; 'lines,':
0.84; 'skip:d 30': 0.86; 'url-ip:104.26.0/24': 0.91; 'url-
ip:104.26.1/24': 0.91; 'url-ip:172.67.74/24': 0.91; 'width': 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=2I1/tuVMYXD98+b5fjdHtRdQiU95959Zti3Kyw8P5cQ=; b=Dk5d5xEMJmoldivd/3jXhHA8di
uhymlnOCC9ozoBgVjw8w6WagUHu26MvP8ATMr4o0rPr++ibof0mh+7zvI1pNJfXs1b1QP8U/a1CfH
JAAf3aLsTi97BzPjF2OMWkktdcAf2flsXwHnWWCtxJpjbwyWeFv0Smk9EH6rWUnB6kszZPu3Q/PoQ
vLANqzD1RGUghknq5WmZJ2Sl3UAGgCi+ZZHuA0Zl/545VxQVpUFXbmfoTXB2y/LD4uaSGsdO2ima2
o/JFeCB25ra7fAiMGO1yBl/CkBYEIcT1m5vCrb95Qdn6C2J2WQA/f3K5KuA6TUaKtz8utyb6CfQXT
Gm8ntymA==;
In-Reply-To: <YSk8GdaBpuz6JIjb@icerm-dld>
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQIBrHSAlQxLpz/02hxfhEU+hmQ+VAJNZxXTqyG1wvA=
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: <005c01d79bbe$410754d0$c315fe70$@SGA.Ninja>
X-Mailman-Original-References: <000801d79a91$b4d851d0$1e88f570$@SGA.Ninja>
<YSk8GdaBpuz6JIjb@icerm-dld>
 by: Steve - Sat, 28 Aug 2021 03:39 UTC

I would like to know how the data is placed on the Y-axis and at the tops of
the bars.
The data is not being shown properly. With some exceptions, it looks as if
the data is getting sorted independently from the dates.

OK, here is the code:
==============================================
# https://matplotlib.org/stable/gallery/index.html
import matplotlib.pyplot as plt
import numpy as np

width = 12 #Width of the graph
height = 6 #Height of the graph

plt.rcParams["figure.figsize"] = (width,height)
plt.rcParams["font.size"] = (9.0)

Count = 0
datesList = [] # Each date showing end of bottle use
hoursList = [] # Number of hours
# daysList = [] # Number of days calculated from hours/24
countList = [] # simple tally

with open("__Insulin_Tracker.txt", 'r') as infile:
for lineEQN in infile:
insulinHours = lineEQN[47:52].strip()
print("Hours = " + insulinHours)
hoursList.append(insulinHours)

insulinDates = lineEQN[20:30].strip()
datesList.append(insulinDates)

# insulinDays= lineEQN[57:62].strip()
# daysList.append(insulinDays)

Count += 1
countList.append(str(Count))
# print(" " + str(Count) + " " + insulinDates + " Hours: " +
insulinHours)
x = Count
count = str(Count)

# Each date indicated the date on which a bottle of insulin has been
depleted
# The bar is to show the number of hours that the bottle has been in use.

Labels = datesList
Xdata= hoursList

Title = ("Bottle List Number of entries: " + count)
x = np.arange(len(Labels)) # the label locations

width = 0.35 # the width of the bars
margin = 0

fig, ax = plt.subplots()
fig.tight_layout(pad=10) # Sets the size of the graph

rects1 = ax.bar(x - width/2, Xdata, width, label='Hours') #Populates the x
axis

# Add some text for labels, title and custom x-axis tick labels, etc.
# fontsize = 20

ax.set_ylabel('Hours of use for each bottle')
ax.set_title(Title)
ax.set_xticks(x)
ax.set_xticklabels((datesList), rotation = 90) #Dates at bottom of the graph
ax.legend()
ax.bar_label(rects1, padding=0,rotation = 90)

plt.show()

===================================
Here is my data in __Insulin_Tracker.txt (with indents)
===================================

Sat Jan 02, 2021 15 29 1.21
Thu Jan 07, 2021 01 116 4.83
Tue Jan 12, 2021 01 120 5.00
Fri Jan 15, 2021 23 74 3.08
Tue Jan 19, 2021 22 95 3.96
Fri Jan 22, 2021 21 71 2.96
Tue Jan 26, 2021 08 103 4.29
Sun Jan 31, 2021 23 115 4.79
Fri Feb 05, 2021 01 118 4.92
Mon Feb 08, 2021 20 71 2.96
Thu Feb 11, 2021 18 80 3.33
Tue Feb 16, 2021 08 120 5.00
Fri Feb 19, 2021 18 72 3.00
Wed Feb 24, 2021 01 113 4.71
Sun Feb 28, 2021 22 97 4.04
Thu Mar 04, 2021 11 95 3.96
Mon Mar 08, 2021 18 103 4.29
Sat Mar 13, 2021 15 117 4.88
Wed Mar 17, 2021 10 91 3.79
Sun Mar 21, 2021 00 96 4.00
Fri Mar 26, 2021 00 120 5.00
Tue Mar 30, 2021 17 103 4.29
Sat Apr 03, 2021 00 89 3.71
Wed Apr 07, 2021 23 99 4.12
Sun Apr 11, 2021 05 98 4.08
Thu Apr 15, 2021 14 95 3.96
Sun Apr 18, 2021 23 71 2.96
Fri Apr 23, 2021 23 120 5.00
Tue Apr 27, 2021 17 100 4.17
Tue Jul 27, 2021 21 2178 90.75
Sun Aug 01, 2021 18 127 5.29
Thu Aug 05, 2021 23 91 3.79
Tue Aug 10, 2021 17 124 5.17
Sat Aug 14, 2021 21 90 3.75
Thu Aug 19, 2021 09 128 5.33
Wed Aug 25, 2021 02 137 5.71

-----Original Message-----
From: Python-list <python-list-bounces+gronicus=sga.ninja@python.org> On
Behalf Of David Lowry-Duda
Sent: Friday, August 27, 2021 3:25 PM
To: python-list@python.org
Subject: Re: matplotlib questions

> I am trying to modify the "Bar Graph Demo" at
> https://matplotlib.org/stable/gallery/index.html, Lines, bars, and
> markers but the more I experiment and change the code, the more messed
> up it becomes.

It is much easier to give constructive suggestions if you give a minimum
runnable code sample that indicates what you're trying and what you're
trying to do. See also http://catb.org/~esr/faqs/smart-questions.html

I'll also note that I see nothing called "bar graph demo" on the gallery
page.

- DLD
--
https://mail.python.org/mailman/listinfo/python-list

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor