我想将我的图形的起点(在x轴和y轴上)设置为零。我使用了xlim()和ylim()函数,但都无济于事。我已经附上了我的代码如下。
setwd ("D:/Rcode/Assignment_2") #setting up the working directory
LightGrowth1 <- read.csv ("LightGrowth-1.csv") #reading the file and attaching it to a dataframe
Light <- LightGrowth1$light #attach our light valu
在使用R plotly包4.5.6版时,我还不知道如何在使用subplot合并多个绘图时显示轴标签。下面是一个不显示x轴标签的示例。
require(plotly)
a <- data.frame(x1=1:3, y=30:32)
b <- data.frame(x2=11:13, y=31:33)
u <- plot_ly(a)
u <- add_lines(u, x=~x1, y=~y)
v <- plot_ly(b)
v <- add_lines(v, x=~x2, y=~y)
subplot(u, v, shareY=TRUE)
我想用一个例子来解释我的查询,下面是一个示例代码片段
x = [i for i in range(1, 129)]
y = [i**2 for i in x]
plt.plot(x, y)
plt.show()
输出:
我想要缩放y轴,这样它只显示三个等间距的ytick标签: 15000,5000,15000,为此我使用了matplotlib的set_yticks功能:
x = [i for i in range(1, 129)]
y = [i**2 for i in x]
plt.plot(x, y)
plt.yticks([0, 7500, 15000], [0, 5000,
我想在R中扩展x轴上的刻度标记之间的间距。
我在x轴c(2005:2012)上有年,y轴上每年有一个值。说:
A <- c(5,4,6,7,3,8,4,2)
B <- c(2005:2012)
plot(B, A, type="l")
现在,我需要扩大每个勾标之间的间距,以便“平放”我的情节,以获得更好的概览。我的R知识已经接近尾声,我还没有在互联网上找到任何东西,请帮助。我只使用R的标准图形包。
我找到了关于如何使用matplotlib:来完成hinton图的示例。
我需要多个图表和一个带有标签的yaxis,所以我把它重写如下
import matplotlib.pyplot as plt
import numpy as N
def hintonForTwo(W1, W2, maxWeight=None):
height, width = W1.shape
if not maxWeight:
maxWeight = 2**N.ceil(N.log(N.max(N.abs(W1)))/N.log(2))
fig, (ax1, ax2) = p