0

I have coordinates of a rectangle (say p1,p2,p3,p4) and needs to draw the rectangle in terminal using asciiplotlib python library

import asciiplotlib as apl
import numpy

x = numpy.linspace(0, 2 * numpy.pi, 10)
y = (some rectangle generator function using coordinates p1,p2,p3,p4)

fig = apl.figure()
fig.plot(x, y, label="data", width=50, height=15)
fig.show()

I have coordinates of a rectangle and needs to draw the rectangle in the terminal using the asciiplotlib python library.

The final result I am expecting is that it should draw a rectangle inside the x-y coordinate plane

  • This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level. You also need to state exactly what your difficulty is, what you expected, what you got, and any traceback. It also is not clear just how those "coordinates" define the rectangle--there are multiple standards. Please clarify. – Rory Daulton Jun 23 '19 at 18:31
  • 1
    Another problem is that a "rectangle" is not the graph of a function, since for a given `x` value there may be two or more `y` values. How should that be handled? – Rory Daulton Jun 23 '19 at 18:36
  • I am working on object detection and drawing a rectangle around the detected object. For time being I have only one object in the frame, so I know coordinate of the rectangle. Now, I have to plot that rectangle in the terminal using asciiplotlib. As far as I have gone through asciiplotlib examples and syntax on the internet, I found that I have to write a function that can generate a rectangle. I am using the following line as a reference to plot the rectangle "fig.plot(x, y, label="data", width=50, height=15)".There is not sufficient detail to plot shapes in the asciiplotlib official page. – Jaydeep Chauhan Jun 23 '19 at 18:43
  • @RoryDaulton Yes, I agree with your point 2. So if you can suggest a way to handle the situation, it will be a great help. But, somehow I have to plot the rectangle graph in terminal only as I am working on headless RaspberryPi and will be accessing it using ssh. – Jaydeep Chauhan Jun 23 '19 at 18:58
  • Author of asciiplotlib here. Drawing rectangles is not supported by asciiplotlib. – Nico Schlömer Jun 24 '19 at 13:24
  • @NicoSchlömer Thank you for confirmation :) – Jaydeep Chauhan Jun 24 '19 at 16:13

0 Answers0