我想绘制这些数据
#include<iostream>
using namespace std;
struct list
{
int data;
list *next;
list *prev;
};
list* createNode()
{
list *node = new list;
node->next = NULL;
node->prev = NULL;
return node;
}
void insert(list**head,int data,int position)
{
int k = 1;
list *current, *temp, *node = createNode();
current = NULL;
temp = *head;
node->data = data;
if (position==1)
{
node->next = *head;
*head = node;
if (*head)
{
(*head)->prev = node;
}
}
else
{
while (temp->next!= NULL&&k < (position-1))
{
temp = temp->next;
k++;
}
node->next = temp->next;
node->prev = temp->prev;
if (temp->next)
temp->next->prev = node;
temp->next= node;
}
}
void del(list**head, int position)
{
int k = 1;
list *current, *temp;
current = NULL;
temp = *head;
if (position == 1)
{
*head = (*head)->next;
if (*head != NULL)
(*head)->prev = NULL;
delete temp;
return;
}
while (k < position&&temp->next != NULL)
{
temp = temp->next;
k++;
}
current = temp->prev;
current->next = temp->next;
if (temp->next)
temp->next->prev = current;
delete temp;
return;
}
void parse(list * temp)
{
while (temp != NULL)
{
cout << "->" << temp->data;
temp = temp->next;
}
}
void main()
{
struct list *head = NULL;
start:
int choice;
cin >> choice;
switch (choice)
{
case 1: int data, position;
cout << "\ndata:"; cin >> data; cout << "\nposition:";
cin>>position;
insert(&head, data, position);
goto start;
case 2:parse(head);
goto start;
case 3: cout << "\nposition:"; cin >> position;
del(&head, position);
goto start;
default: break;
}
exit(0);
}
使用此代码
1 2
2 3
3 5
4 5
5 6
线宽命令似乎有效,但似乎不适用于小于1的线宽。
此图的线宽为5:
此图的线宽为1
该图的线宽为0.2
人们可能会注意到,后两个地块之间没有区别。如何强制gnuplot使用小于1的线宽?