Python Forum
Reportlab: Add xlabel, ylabel and grid to lineplot
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reportlab: Add xlabel, ylabel and grid to lineplot
#3
I'm sorry

import reportlab
from reportlab.pdfgen import canvas
from reportlab.graphics import renderPDF
from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.lineplots import LinePlot
from reportlab.graphics.charts.barcharts import VerticalBarChart
from reportlab.graphics.widgets.markers import makeMarker
from reportlab.graphics.charts.legends import LineLegend
from reportlab.graphics.charts.lineplots import GridLinePlot
from reportlab.graphics.charts.lineplots import GridLinePlot
from reportlab.lib.colors import Color
from reportlab.graphics.charts.legends import LineLegend
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
from reportlab.lib.validators import Auto
from reportlab.graphics.charts.axes import NormalDateXValueAxis



def line_plot():
	drawing = Drawing(400, 200)
	Data = [[[1,1], [2,2], [2.5,1], [3,3], [4,5]],[[1,2], [4,6]]]
	lp = LinePlot()
	lp.y                             = 40
	lp.x                             = 30 
	lp.width                         = 500
	lp.height                        = 500


	lp.lineLabels.fontSize           = 6
	lp.lineLabels.boxStrokeWidth     = 0.5
	lp.lineLabels.visible            = 1
	lp.lineLabels.boxAnchor          = 'c'
	lp.lineLabels.angle              = 0
	lp.lineLabelNudge                = 10
	lp.joinedLines                   = 1
	lp.lines.strokeWidth             = 1.5

	lp.data  = Data
	drawing.add(lp)
	
	
	return drawing

the_canvas = canvas.Canvas("output.pdf")
the_canvas.drawString(100,750,"Welcome to Reportlab!")
renderPDF.draw(line_plot(), the_canvas, 10, 10)
the_canvas.showPage()

the_canvas.save()
Reply


Messages In This Thread
RE: Reportlab: Add xlabel, ylabel and grid to lineplot - by denissanga - Dec-19-2017, 04:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] Looking for documentation on Reportlab's canvas.transform() function NeilUK 1 554 Aug-23-2023, 01:21 PM
Last Post: NeilUK
  Right to left alignment in python report using Reportlab jalal0034 1 1,763 Sep-27-2022, 04:25 AM
Last Post: jalal0034
  Label Maker FPDF, Reportlab jamesaarr 1 2,603 Aug-09-2021, 11:57 PM
Last Post: Pedroski55
  cyrillic symbols in tables in reportlab. hiroz 5 11,201 Sep-10-2020, 04:57 AM
Last Post: bradmalcom
  Using Reportlab to create a landscape pdf SmukasPlays 2 5,285 Aug-09-2020, 09:31 PM
Last Post: SmukasPlays
  Help! - How to create a Title for a Reportlab Table crabbylou 0 5,272 Mar-29-2020, 09:14 PM
Last Post: crabbylou
  ReportLab Polypop77 0 1,803 Mar-20-2020, 01:17 PM
Last Post: Polypop77
  Inserting a variable name into xlabel myersluke 0 1,456 Jun-19-2019, 10:22 PM
Last Post: myersluke
  Python Reportlab Wordwrap Table Mady 0 6,912 Dec-18-2018, 06:31 AM
Last Post: Mady
  Reportlab Dynamic Table Q Gutt 0 5,709 Jun-13-2018, 10:18 PM
Last Post: Gutt

Forum Jump:

User Panel Messages

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