小编has*_*e55的帖子

使用matplotlib中的绘图,轴或图形绘制绘图有什么区别?

当我在matplotlib中绘制情节时,我有点困惑后端的情况,tbh,我不清楚情节,轴和图的层次结构.我阅读了文档,这很有帮助,但我仍然感到困惑......

以下代码以三种不同的方式绘制相同的图表 -

#creating the arrays for testing
x = np.arange(1, 100)
y = np.sqrt(x)
#1st way
plt.plot(x, y)
#2nd way
ax = plt.subplot()
ax.plot(x, y)
#3rd way
figure = plt.figure()
new_plot = figure.add_subplot(111)
new_plot.plot(x, y)
Run Code Online (Sandbox Code Playgroud)

现在我的问题是 -

  1. 三者之间有什么区别,我的意思是当调用3种方法中的任何一种时,会发生什么?

  2. 应该使用哪种方法何时以及使用任何方法的利弊是什么?

python matplotlib

72
推荐指数
2
解决办法
2万
查看次数

Android致命信号11(SIGSEGV),代码1,tid 29092中的故障地址0x0

我试着在我的加载屏幕上播放加载动画,我读到某个地方,android不支持GIF,所以要么你必须闯入帧然后播放它,或者我们可以使用Movie类.

继承人主导活动 -

package com.myapp.mehul.login.activity;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.util.Log;

import com.myapp.mehul.login.MYGIFView;
import com.myapp.mehul.login.MainActivity;
import com.myapp.mehul.login.R;
import com.myapp.mehul.login.app.Constants;

import org.json.JSONException;
import org.json.JSONObject;

import java.net.URISyntaxException;

import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;


/**
 * Created by mehul on 2/6/16.
 */
public class LoadingScreen extends Activity {

    /** Duration of wait **/
    private final int SPLASH_DISPLAY_LENGTH = 1000;

    /** Called when the activity is first created. */
    private Socket mSocket;
    String you;
    String opponentId;
    String username; …
Run Code Online (Sandbox Code Playgroud)

java android fatal-error android-animation

13
推荐指数
2
解决办法
4万
查看次数

防止AWS Cloudformation中的回滚

当前,我的CFN处于update_rollback_failed状态,并且显然处于死胡同状态。要继续,我必须继续回滚,这不是一种选择。

我们将CFN推迟了3个月,由于某些问题,我们直接从控制台进行了一些更改(巨大的错误),现在我们试图同步在CFN本身中所做的更改。由于某些问题,部署失败,并且开始进行回滚。幸运的是,由于对运动学方面的一些检查,回滚失败了。

AWS上可用的CFN包含旧配置,这是灾难性的,肯定会导致大量停机。

我尝试过继续回滚,而忽略了资源,但是它只允许忽略回滚更新失败的那些资源。我应该如何摆脱这种情况?

amazon-web-services aws-cloudformation

5
推荐指数
1
解决办法
123
查看次数

如何将图添加到子图 matplotlib

我有这样的情节

fig = plt.figure()
desire_salary = (df[(df['inc'] <= int(salary_people))])
print desire_salary
# Create the pivot_table
result = desire_salary.pivot_table('city', 'cult', aggfunc='count')

# plot it in a separate step. this returns the matplotlib axes
ax = result.plot(kind='bar', alpha=0.75, rot=0, label="Presence / Absence of cultural centre")

ax.set_xlabel("Cultural centre")
ax.set_ylabel("Frequency")
ax.set_title('The relationship between the wage level and the presence of the cultural center')
plt.show()
Run Code Online (Sandbox Code Playgroud)

我想将此添加到subplot. 我试试

fig, ax = plt.subplots(2, 3)
...
ax = result.add_subplot()
Run Code Online (Sandbox Code Playgroud)

但它返回 AttributeError: 'Series' object has no attribute …

python matplotlib pandas

3
推荐指数
1
解决办法
2万
查看次数